SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Can i use timestamp in order by to get records which are changed , inserted after old time stamp


Can i use timestamp in order by to get records which are changed , inserted after old time stamp

Author
Message
rajemessage 14195
rajemessage 14195
SSC Veteran
SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)SSC Veteran (276 reputation)

Group: General Forum Members
Points: 276 Visits: 348
Dear all,(sqlserver 2005)

i want to save the largest timestamp in a variable then

i want to get the changed and inserted record from a table

like select * from t where timestamp>@timestamp

is the above is correct ( basically i wanted timestamp to use in my stored proc which can

get me differential from database)

2) I could not under stand , how duplicate are getting created ,please tel me how it following is possible.(http://technet.microsoft.com/en-us/library/ms182776%28v=sql.90%29.aspx)

Duplicate timestamp values can be generated by using the SELECT INTO statement in which a timestamp column is in the SELECT list. We do not recommend using timestamp in this manner.


yours sincerely
Koen Verbeeck
Koen Verbeeck
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27573 Visits: 13268
The name timestamp is very badly chosen. It is a binary number, not an actual date.
Given the issues with timestamp, wouldn't it be easier to just use an IDENTITY column? This simply increments for every new record.
You can have gaps (if transactions fail for example), but as long as you don't mess with the column new values have always bigger values than the previous ones and duplicates do not occur.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search