• Lynn Pettis - Tuesday, November 14, 2017 4:39 PM

    Alan.B - Tuesday, November 14, 2017 4:36 PM

    Please forgive me if I'm misunderstanding what you said but I don't get this:

    It's currently a heap with a NC Primary Key, but I feel that it should be clustered to prevent duplication of data.

    This will fail:
    create table dbo.x (id int primary key nonclustered);
    insert dbo.x values (1),(1);

    This will not:
    create table dbo.y (id int not null);
    create clustered index cl_y on dbo.y(id);
    insert dbo.y values (1),(1);

    Pretty sure he was talking about making the primary key (all the columns of the table in this case) a clustered index instead of a nonclustered index.

    Yes, I should have made myself clearer. I was talking about duplicating the data by storing each row in the table and the non clustered index instead of only once using a clustered index.
    The primary key needs to be kept in place, but I want to make sure that making it clustered instead of non-clustered is the right choice.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2