I have a temporary table that I’m using and I have a unique column, example:myID INT UNIQUE
Would this create an index on that column? Or do I have to explicitly create the index?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, SQL server will automatically create an index for each additional unique constraint.
http://msdn.microsoft.com/en-us/library/ms177420.aspx
“The Database Engine automatically creates a UNIQUE index to enforce the uniqueness requirement of the UNIQUE constraint….Unless a clustered index is explicitly specified, a unique, nonclustered index is created by default to enforce the UNIQUE constraint.”
This is true for temporary tables, which I just verified by testing.