Good day everyone.
My boss said to me 'Do not put a clustered index on the identity. I want to look at the data later and decide what to cluster on.'
I have a snippet of code. It functions, but I am not sure that I completely grasp what is happening when I run it.
Here is my snippet that I run in SQL Management Studio 2008 R2.
I put in NONCLUSTERED to attempt to meet the request, but I am a little unclear what effect this is having behind the scenes.
First question: Does having and IDENTITY(1,1) PRIMARY KEY automatically make a field a clustered index?
Second question: Does adding NONCLUSTERED do anything? (ie. does it get ignored because the answer to the first question is yes or does it actually prevent clustering?)
Since the snippet runs and creates a table, I am not sure
Thank you all so much,
Patrick B
My boss said to me 'Do not put a clustered index on the identity. I want to look at the data later and decide what to cluster on.'
I have a snippet of code. It functions, but I am not sure that I completely grasp what is happening when I run it.
Here is my snippet that I run in SQL Management Studio 2008 R2.
Code:
CREATE TABLE BendInspection (
BendInspectionID INT IDENTITY(1,1) PRIMARY KEY NONCLUSTERED,
TemplateVersionID UNIQUEIDENTIFIER NOT NULL,
ReportTypeID INT NOT NULL,
ReportID UNIQUEIDENTIFIER NOT NULL,
GeneralInformationInspectionDate DATETIME NOT NULL,
GeneralInformationProjectNumber UNIQUEIDENTIFIER NOT NULL,
GeneralInformationLineNumber UNIQUEIDENTIFIER NOT NULL);
I put in NONCLUSTERED to attempt to meet the request, but I am a little unclear what effect this is having behind the scenes.
First question: Does having and IDENTITY(1,1) PRIMARY KEY automatically make a field a clustered index?
Second question: Does adding NONCLUSTERED do anything? (ie. does it get ignored because the answer to the first question is yes or does it actually prevent clustering?)
Since the snippet runs and creates a table, I am not sure
Thank you all so much,
Patrick B