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
»
Business Intelligence
»
Implementing Surrogate Key
Implementing Surrogate Key
Rate Topic
Display Mode
Topic Options
Author
Message
Shadab Shah
Shadab Shah
Posted Thursday, August 02, 2012 3:49 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Sunday, May 19, 2013 9:07 PM
Points: 162,
Visits: 336
How to implement surrogate key ?
Post #1339037
ChrisM@Work
ChrisM@Work
Posted Thursday, August 02, 2012 6:35 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 5,613,
Visits: 10,980
shahsn11 (8/2/2012)
How to implement surrogate key ?
CREATE TABLE MyTable (
MyTableID INT IDENTITY(1,1) PRIMARY KEY,
.
.
.
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.”
- Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read
this article
.
Understanding and using APPLY, (I)
and
(II)
Paul White
Hidden RBAR: Triangular Joins
/
The "Numbers" or "Tally" Table: What it is and how it replaces a loop
Jeff Moden
Exploring Recursive CTEs by Example
Dwain Camps
Post #1339095
Shadab Shah
Shadab Shah
Posted Thursday, August 02, 2012 7:08 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Sunday, May 19, 2013 9:07 PM
Points: 162,
Visits: 336
So does that mean that Surrogate Key is only the concept. And in lay man terms(i.e. mine) can we say that PK=Surrogate Key.
If the above is true that what is the difference between Pk and surrogate key.
Post #1339128
Koen Verbeeck
Koen Verbeeck
Posted Thursday, August 02, 2012 7:18 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 6:51 AM
Points: 9,372,
Visits: 6,470
shahsn11 (8/2/2012)
So does that mean that Surrogate Key is only the concept. And in lay man terms(i.e. mine) can we say that PK=Surrogate Key.
If the above is true that what is the difference between Pk and surrogate key.
A surrogate key is by defination meaningless, aka a simple integer with no meaning attached which serves as a primary key. A primary key is a combination of one or more columns that uniquely identify a row. So it's possible this is for example a customerID, such as AW001578. This has meaning, as it is customer number 1578 of the Adventure Works company. Or it can be an emailaddress to uniquely identify a person. This is often called the "natural key".
So, a surrogate key is a primary key, but a primary key is not necessarily a surrogate key.
How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
Member of
LinkedIn
. My blog at
LessThanDot
.
MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1339139
ChrisM@Work
ChrisM@Work
Posted Thursday, August 02, 2012 7:25 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 5,613,
Visits: 10,980
shahsn11 (8/2/2012)
So does that mean that Surrogate Key is only the concept. And in lay man terms(i.e. mine) can we say that PK=Surrogate Key.
If the above is true that what is the difference between Pk and surrogate key.
A PK is a means of uniquely identifying a row. It's either an attribute(s) of the data (natural key), or it can be generated by the RDBMS (surrogate key). Here's a nice
article
to get you started.
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.”
- Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read
this article
.
Understanding and using APPLY, (I)
and
(II)
Paul White
Hidden RBAR: Triangular Joins
/
The "Numbers" or "Tally" Table: What it is and how it replaces a loop
Jeff Moden
Exploring Recursive CTEs by Example
Dwain Camps
Post #1339149
« 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.