Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234

Primary Keys Expand / Collapse
Author
Message
Posted Sunday, March 21, 2010 8:04 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Saturday, June 28, 2014 8:50 AM
Points: 2,649, Visits: 766
When are Kim and Paul coming to Atlanta... this sounds like a great lecture.

Jamie
Post #887070
Posted Tuesday, March 30, 2010 8:13 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:20 PM
Points: 11,194, Visits: 11,142
Good question, but the wording could have been clearer. Nice easy points though - thanks.



Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #892804
Posted Thursday, April 1, 2010 1:18 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, August 18, 2014 2:16 AM
Points: 196, Visits: 658
Hi Hugo,

The 3rd and 6th options seems similar.

Shaiju C.K.


_____________________________________________
One ounce of practice is more important than tonnes of dreams
Post #894476
Posted Thursday, April 1, 2010 1:33 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:14 PM
Points: 5,977, Visits: 8,237
C.K.Shaiju (4/1/2010)
Hi Hugo,

The 3rd and 6th options seems similar.

Shaiju C.K.

You are right! Thanks for pointing it out. The sixth option should have read "A clustered index exists ..." instead of "No clustered index exists ..."

I have edited my post to prevent future confusion.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #894481
Posted Saturday, April 3, 2010 2:39 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 11, 2014 5:06 AM
Points: 959, Visits: 63
When we creates the primary key it alwas enforce to create as Clustured.
how it will enforce to create as NonClustered.

Please Can u tell me.
Post #896178
Posted Saturday, April 3, 2010 2:53 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:20 PM
Points: 11,194, Visits: 11,142
parthenitin (4/3/2010)
When we creates the primary key it alwas enforce to create as Clustured.
how it will enforce to create as NonClustered.
Please Can u tell me.

Use the NONCLUSTERED keyword.
See Creating and Modifying PRIMARY KEY Constraints

Example:
DECLARE @Table
TABLE (
column1 INTEGER NOT NULL
PRIMARY KEY NONCLUSTERED
);





Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #896181
Posted Saturday, April 3, 2010 6:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:14 PM
Points: 5,977, Visits: 8,237
parthenitin (4/3/2010)
When we creates the primary key it alwas enforce to create as Clustured.
how it will enforce to create as NonClustered.

Please Can u tell me.

In addition to the reply by Paul -- if there is already a clutered index on the table, then the index for the primary key will also default to nonclustered.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #896218
Posted Sunday, April 4, 2010 2:21 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, June 28, 2014 4:30 PM
Points: 27, Visits: 59
Thanks Hugo. That was the main one (and point) I was making.

Often people use scripts to create objects but there are strange cases where multiple developers working on the same project creates... er... "issues" and the indexes aren't quite as consistent as expected. Constraints are often created via scripts but often as standalone scripts (not always as part of the table's create) and sometimes problems can occur when there are too many cooks in the kitchen.

Cheers!
Kimberly L. Tripp
SQL Server MVP, Microsoft Regional Director
blog: www.SQLskills.com/blogs/Kimberly
twitter: www.twitter.com/KimberlyLTripp
Post #896469
Posted Friday, May 27, 2011 3:54 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 9, 2014 1:24 AM
Points: 375, Visits: 114
False, if a clustered index already exists, DB will enforce the Primary Key constraint with a nonclustered index
Post #1116092
Posted Friday, May 27, 2011 3:55 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, June 9, 2014 1:24 AM
Points: 375, Visits: 114
if a clustered index already exists, SQL Server will enforce the Primary Key constraint with a nonclustered index
Post #1116093
« Prev Topic | Next Topic »

Add to briefcase «««1234

Permissions Expand / Collapse