Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
nemohm
Yak Posting Veteran
69 Posts |
Posted - 2003-04-30 : 19:51:10
|
I have a column with timestamp data type.As usually I'm confused with dates!What would look like e query against that table that will work?(For queering in certain time period)SELECT *FROM eventWHERE logtimestamp > dateadd(hour, -1, getdate()Thx,Dobby |
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-04-30 : 20:26:13
|
You can usebetween timex and timeyor >= timex and <= timeybe careful of comparing date with time of 0 against date with time.also date calculations are only accurate to 3 milliseconds. |
|
|
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2003-04-30 : 23:33:24
|
You may need to use TSEQUAL() function.[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=19553[/url]Jung |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-05-01 : 10:03:25
|
oops!TimeStamp RightAre you sure you want to use a timestamp not a datetime?Are you trying to track changes to each row and if so microsoftsuggests using rowversion instead because timestamp is likely to change in the future.Edited by - ValterBorges on 05/01/2003 10:07:42 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-05-01 : 10:41:22
|
I've never used timestamp (DB2 Timestamp is a datetime and I remeber years ago be confused by this).Does anyone use a timestamp? I mean isn't identity almost the same thing?Just curious.Brett8-) |
|
|
nemohm
Yak Posting Veteran
69 Posts |
Posted - 2003-05-01 : 11:15:04
|
I have table created with column logtimestamp - timestamp datatype by an aplication. Rows are not changed, only new rows are added.The access to table is via ODBC driver.I need to transfer periodically this table to SS2K;the chunks of data have to be hours or minutes.SELECT *FROM mtWHERE lodtimestamp ??? --- must be one hour in the pastwith datetime it's clear:WHERE logtimestamp>DATEADD(hour, -1, GETDATE())What (if there is any) is the way to achieve retrieval from timestamp datatypefor rows added in the last one hour? Thx,Dobby |
|
|
|
|
|