Solved

Primary key as NC

Posted on 2010-08-13
4
241 Views
Last Modified: 2012-05-10
Is it possible for a PK to a NC instead of being clustered. When I create a PK, it automatically gets created as Clustered.

thanks
0
Comment
Question by:anushahanna
4 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 250 total points
ID: 33431984
Absolutely...by default sql makes it clustered unless otherwise specified

create table tablename(fld1 int not null, constraint pk_tablename primary key nonclustered (fld1))
0
 
LVL 16

Assisted Solution

by:vdr1620
vdr1620 earned 250 total points
ID: 33432503
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33432814
Thanks.
0
 
LVL 22

Expert Comment

by:dportas
ID: 33440881
In fact if you create a PRIMARY KEY constraint on a table that already has a clustered index then the PRIMARY KEY will automatically be created as a nonclustered index unless you specify otherwise.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now