?
Solved

PRIMARY KEY NONCLUSTERED

Posted on 2014-07-17
3
Medium Priority
?
421 Views
Last Modified: 2014-11-29
Hi Experts,

I am creating a table for a datawarehouse bd, my question is: because the dimension tables must in PRIMARY KEY NONCLUSTERED

for example:
CREATE TABLE DimProduct
(ProductKey int identity NOT NULL PRIMARY KEY NONCLUSTERED,
 ProductAltKey nvarchar(10) NOT NULL,
 ProductName nvarchar(50) NULL,
 ProductDescription nvarchar(100) NULL,
 ProductCategoryName nvarchar(50))
GO
0
Comment
Question by:enrique_aeo
3 Comments
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 40203706
Hi enrique,

I don't see a question there.  :)
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 600 total points
ID: 40203713
sorry I don't understand what the question is

are you asking: WHY would you use a non-clustered index on the primary key?

(I'm not sure why you MUST do this. Has someone told you to do it this way?)

It is very good to make define the clustered key using fields that will give you maximum advantage - often this isn't the primary key.

(+edit}
here is aprevious question/example of using a clustered key that isn't the primary key:
http://www.experts-exchange.com/Database/MS-SQL-Server/SQL_Server_2008/Q_28294233.html
0
 
LVL 13

Assisted Solution

by:magarity
magarity earned 400 total points
ID: 40203807
I think you're going to regret making this one nonclustered. Who told you to do it this way?  this is a pretty straightforward table and straightforward looking primary key field.  it's a textbook case to make this a clustered index.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question