简体   繁体   English

在SQL 2008中为TVP创建一个INDEX

[英]create an INDEX for a TVP in SQL 2008

Can we create an Index for TVP's(Table valued Parameters) in SQL Server 2008. 我们可以在SQL Server 2008中为TVP(表值参数)创建索引。

please can any one give the syntax. 请任何人都可以给出语法。

Thanks In advance.. Vinay K 在此先感谢.. Vinay K.

You can have primary key and unique constraints , which will automatically have indexes backing them, but you're unable to declare any indexes explicitly for table types 您可以拥有主键和唯一约束 ,这些约束将自动具有支持它们的索引,但您无法为表类型显式声明任何索引


If you think your query could benefit from further indexes, pretty well you'll have to copy the rows from your TVP into a temporary table (not table variable), on which you can define any indexes you want. 如果您认为您的查询可以从其他索引中受益,那么您必须将TVP中的行复制到临时表(而不是表变量)中,您可以在其上定义所需的任何索引。 But obviously that will add some additional overhead (in time and memory costs) 但显然会增加一些额外的开销(时间和内存成本)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM