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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 BETWEEN CURRENT_TIMESTAMP

Author  Topic 

abunney
Starting Member

2 Posts

Posted - 2005-06-22 : 12:32:21
Hi hope someone can help as my skills with T-SQL are rudimentary as they are very peripheral to my job.

I have a database with a table called forumMessages to store some forum postings, these are timestamped when inserted into the database.

I want to extract all fields for all off the postings
by a particular user in the last 360(for example) days, I've got this far:

SELECT *
FROM dbo.forumMessages
WHERE authorID = 150 AND timestamp BETWEEN CURRENT_TIMESTAMP AND DATEADD(day, -360, CURRENT_TIMESTAMP);

This runs OK but returns no records (this should produce lots records if it was doing what my addled brain thought it was doing).

Now I am stumped, any ideas?

Cheers

Andrew

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-06-22 : 12:53:13
reverse the dates so that:

between <earlierDate> and <laterDate>

Be One with the Optimizer
TG
Go to Top of Page

abunney
Starting Member

2 Posts

Posted - 2005-06-22 : 13:25:19
Many thanks!
Go to Top of Page
   

- Advertisement -