Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to put Index on table variable

Author  Topic 

aoriju
Posting Yak Master

156 Posts

Posted - 2011-05-25 : 01:41:58
Hi,

how to put index on table variable

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-05-25 : 01:57:11
You can't run CREATE INDEX against a table variable. If the column is unique or could be made unique, create a unique constraint as part of the table's definition.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

aoriju
Posting Yak Master

156 Posts

Posted - 2011-05-25 : 01:58:17
Could you pls give me an example
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-05-25 : 04:00:35
http://sqlinthewild.co.za/index.php/2010/10/12/a-trio-of-table-variables/

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -