0

SQL Server help:

I have created a local table @Emp in my database and inserted values to it. Can I add clustered indexes on this table? I need to reduce my sorting cost (78%), hence I need to do this.

  • Yes, you can... CREATE CLUSTERED INDEX idxName ON dbo.TestTable (TestCol1); – User2012384 Jun 01 '15 at 09:17
  • 1
    @User2012384 No, user is using a table variable -- only primary keys and unique constraints are allowed in definition. – TZHX Jun 01 '15 at 09:18
  • During creation of table variable we can. Not after that. `declare @table1 table(a int primary key clustered)` – ughai Jun 01 '15 at 09:21

0 Answers0