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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

osql datetime syntax

Status
Not open for further replies.

WaitronUnit

IS-IT--Management
Dec 2, 2003
38
I am a database novice and can't get datetime usage right. There is a stored procedure named ms_purgeolddata that when I enter

exec ms_purgeolddata null

it works fine and will delete all past data. What I need to find out is how to delete data prior to a certain time, like midnight on Decmber 31, 2004. I have tried

exec ms_purgeolddata @date 20050101
exec ms_purgeolddata @date=20050101
exec ms_purgeolddata 20050101
exec ms_purgeolddata @date 200501301 00:00:00

etc., and I keep getting "Error converting data type int to datetime." What I am doing wrong? Thanks for any help!
 
YOu need single quotes around the date:

exec ms_purgeolddata '20050101'

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top