• ahmed7.bi (12/12/2010)


    Hi

    i have read that only one unique clustered index can be created on a table and many non clustered index

    then how come the below commands works fine as it is creating a unique clustered index on 2 columns of a table

    create table test4 (id int,pid int,pname char(25))

    go

    create unique clustered index indx_test on test4 (id, pid) --

    if the above case is right then how many columns can we include in a clustered index.???

    From BOL section "Clustered Index Design Guidelines" -

    "Clustered indexes sort and store the data rows in the table based on their key values. There can only be one clustered index per table, because the data rows themselves can only be sorted in one order."

    and -

    "Generally, you should define the clustered index key with as few columns as possible."


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]