Skip to content
Advertisement

Sql server clustered index on multiple column with different sort direction

Can I have a clustered index created on multiple columns with different sort direction. For example
Create Clustered Index IX_Name on Table1(Empid asc,empname desc,sal asc)

If the answer is yes I am curious to know how, since clustered index store data in one particular order and in the above case we want index to created on three different sort direction.

Thanks in advance

Advertisement

Answer

Yes you can, and the values of the index are not even required to be Unique, if they are not, SQL Server will append a row identifier to each row to make it unique

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement