Can we create clustered index on non primary key column

  • Hi Guys...Please let mi Clarify The is it Possible to '

    Can we create clustered index on non primary key column '

    Because when i was tried in a sample table without primary key. and cluster index it was creating and as well as accepting nulls and duplicates also..

    i was attached those pics are in below...

    please kindly clarify my doubt frds.....!

    Pavan Kumar. Pala[font="Verdana"][/font]
  • pavanpala.vja (8/5/2012)


    Can we create clustered index on non primary key column '

    Yes.

    Because when i was tried in a sample table without primary key. and cluster index it was creating and as well as accepting nulls and duplicates also..

    That is expected behavior.

  • Hi suresh thanks for ur reply..

    can u please clarify my doubt then..

    So.......If u create an unique Clustered index On a table then is it allow...Nulls and duplicate values the.....By default..?

    Pavan Kumar. Pala[font="Verdana"][/font]
  • Yes we can create Clustered Index on a non-unique and nullable column.

    If the clustered index is not a unique index, SQL Server makes any duplicate keys unique by adding an internally generated value called a uniqueifier.

    Ref: http://www.sqlservercentral.com/blogs/aschenbrenner/2010/08/19/unique_2F00_non_2D00_unique-clustered-indexes/

    For more information read BOL.

    [font="Verdana"]Regards,
    Rals
    [/font].
  • pavanpala.vja (8/5/2012)


    So.......If u create an unique Clustered index On a table then is it allow...Nulls and duplicate values the.....By default..?

    Unique Clustered Index does not allow duplicate values.

    Single NULL value is considered as a unique value.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply