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
 Index creation fails

Author  Topic 

sqlbug
Posting Yak Master

201 Posts

Posted - 2009-08-20 : 18:32:16
I have a table populated with about 6 million records. Now I realize that I should have created another index, but if I try it now - it times out.
How can I do it without removing the data from the table?
Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-20 : 18:59:07
If you are doing this from table designer in SSMS, yes you can time out.
However, if you do it from a query window it will succeed.

CREATE [UNIQUE] [NON][CLUSTERED] INDEX IX_Name ON Table1 (Col1, Col2)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

sqlbug
Posting Yak Master

201 Posts

Posted - 2009-08-20 : 19:11:40
Great, thanks Peso.

For an index not unique, I just needed to omit [UNIQUE].
SQL Server did not like [NON][CLUSTERED], so I removed that from the command as well. and it worked. Now I know(no?) not everything can be done with the visual interface.
Go to Top of Page
   

- Advertisement -