Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 General Discussion
»
Primary keys and indexes
Primary keys and indexes
Rate Topic
Display Mode
Topic Options
Author
Message
meichner
meichner
Posted Wednesday, May 06, 2009 7:21 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, February 06, 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
KenSimmons
KenSimmons
Posted Wednesday, May 06, 2009 7:22 AM
Ten Centuries
Group: General Forum Members
Last Login: Thursday, May 09, 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
meichner
meichner
Posted Wednesday, May 06, 2009 7:29 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, February 06, 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
grigoriadis1
grigoriadis1
Posted Sunday, January 24, 2010 8:40 AM
Forum 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
AndrewSQLDBA
AndrewSQLDBA
Posted Sunday, January 24, 2010 8:45 AM
Right there with Babe
Group: General Forum Members
Last Login: Today @ 2:57 PM
Points: 796,
Visits: 2,280
Look in the SQL Books Online under "Alter Table"
Andrew SQLDBA
Post #852731
GilaMonster
GilaMonster
Posted Sunday, January 24, 2010 8:47 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:18 PM
Points: 37,744,
Visits: 30,025
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
G.R.Prithiviraj Kulasingham
G.R.Prithiviraj Kulasingham
Posted Sunday, January 24, 2010 9:42 AM
SSC-Addicted
Group: General Forum Members
Last Login: Sunday, October 21, 2012 8:59 PM
Points: 421,
Visits: 362
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
homebrew01
homebrew01
Posted Sunday, January 24, 2010 7:20 PM
SSCrazy
Group: General Forum Members
Last Login: Today @ 8:14 AM
Points: 2,555,
Visits: 7,214
GilaMonster (1/24/2010)
Is google down today?
Not again ??!!
Post #852807
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.