Just clarifying a bit...
For a non-clustered index
For a unique non-clustered index
answered Oct 09, 2009 at 12:18 PM
Matt Whitfield ♦♦
aw, heck! what about an example?
but in the heat of the moment I might write
answered Oct 09, 2009 at 02:23 PM
Dont forget, if you are using SSMS, that there are examples of lots of scripts like this in the templates. Hit Ctrl+Alt+T to see the template toolbar and then open the Index folder to see six different examples of index creation scripts. The Create Unique Nonclustered Index script would be closest to the one you want. Drag that to a new script window and edit it as the other answers have suggested, using an index name of your choice and the columns you need to have indexed. Then you simply need to make sure you are in the right database and run the script!
answered Dec 15, 2009 at 05:39 AM