Are timestamp columns good candidates for primary keys? Why?Absolutely not; a timestamp will be automatically updated whenever any
column in the row is updated. That's not a good characteristic for a PK.
Non-key attributes should be dependent on the key, not the other way around.
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--
"docsql" <docsql@.noemail.nospam> wrote in message
news:OIDsnQH7FHA.1028@.TK2MSFTNGP11.phx.gbl...
> Are timestamp columns good candidates for primary keys? Why?
>
>|||Just to follow up on that one, and no offence to Adam, a Primary Key is some
combination of values in a row that uniquely identifies a row in a table
throughout its lifetime. Hence a timestamp, which Adam pointed out is not a
good candidate as it is modified every time an update (or the initial
insert) happens. In fact I'm not even sure whether SQL would allow you to
even attempt to do that. I guess it shouldn't. But that's just my opinion.
Cheers,
Jan
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:uUzYnTH7FHA.1028@.TK2MSFTNGP11.phx.gbl...
> Absolutely not; a timestamp will be automatically updated whenever any
> column in the row is updated. That's not a good characteristic for a PK.
> Non-key attributes should be dependent on the key, not the other way
> around.
>
> --
> Adam Machanic
> Pro SQL Server 2005, available now
> http://www.apress.com/book/bookDisplay.html?bID=457
> --
>
> "docsql" <docsql@.noemail.nospam> wrote in message
> news:OIDsnQH7FHA.1028@.TK2MSFTNGP11.phx.gbl...
>> Are timestamp columns good candidates for primary keys? Why?
>>
>>
>|||Hi,
I found MVP Adam Machanic's answer is very accurate. I wanted to post a
quick note to see if you would like additional assistance or information
regarding this particular issue. We appreciate your patience and look
forward to hearing from you!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.
No comments:
Post a Comment