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

Primary keys and indexes Expand / Collapse
Author
Message
Posted Wednesday, May 6, 2009 7:21 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, February 6, 2012 12:43 PM
Points: 215, Visits: 640
I have a simple question about SQL Server. When I define a field on a table as the primary key, does SQL Server automatically create a corresponding index on that field or do I need to create the index myself.

Thanks
Post #711043
Posted Wednesday, May 6, 2009 7:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, May 9, 2013 8:07 AM
Points: 1,221, Visits: 2,614
By default SQL Server creates a clustered index on the primary key.

Ken Simmons
http://twitter.com/KenSimmons
Post #711045
Posted Wednesday, May 6, 2009 7:29 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, February 6, 2012 12:43 PM
Points: 215, Visits: 640
Ken Simmons (5/6/2009)
By default SQL Server creates a clustered index on the primary key.


Thanks for the fast response.
Post #711051
Posted Sunday, January 24, 2010 8:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, January 24, 2010 8:38 AM
Points: 1, Visits: 0
Anyone know what query I could use to set a primary key using a syntax on a table?
Post #852730
Posted Sunday, January 24, 2010 8:45 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: Thursday, July 17, 2014 3:19 PM
Points: 975, Visits: 3,342
Look in the SQL Books Online under "Alter Table"

Andrew SQLDBA
Post #852731
Posted Sunday, January 24, 2010 8:47 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:14 AM
Points: 42,460, Visits: 35,520
Is google down today?

http://msdn.microsoft.com/en-us/library/ms190273.aspx
There are several examples at the bottom



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #852732
Posted Sunday, January 24, 2010 9:42 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, March 10, 2014 9:05 AM
Points: 421, Visits: 363
GilaMonster (1/24/2010)
Is google down today?

http://msdn.microsoft.com/en-us/library/ms190273.aspx
There are several examples at the bottom


As Google is not down, we expect you to do the search :) Just kidding.


Cheers,
Prithiviraj Kulasingham

http://preethiviraj.blogspot.com/
Post #852738
Posted Sunday, January 24, 2010 7:20 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 8:10 PM
Points: 2,826, Visits: 8,463
GilaMonster (1/24/2010)
Is google down today?



Not again ??!!



Post #852807
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse