Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TimeStamp less 24 hours 1

Status
Not open for further replies.

hamish75

Technical User
Dec 18, 2009
39
0
0
GB
Hi,

I urgently need to create the following in SQL:

Delete
all records
from
Bocs.dbo.stats_one
where
TimeStamp is older than 24 hours and
Code begins with "CC"

I’m not a million miles away I think!...I have the following where I am selecting:

Code:
SELECT * FROM Bocs.dbo.stats_one WHERE LEFT(Code, 2) = 'CC' and TimeStamp = '  ';

I need to change the select to delete but I don’t know how to do the “TimeStamp is older than 24 hours” bit..

Can anyone help?

Thanks.


Ah dinnae ken...
 
And TimeStamp < DateAdd(Hour, -24, GetDate())

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top