Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Primary key as NC

Posted on 2010-08-13
4
244 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

809 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