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

Date Query 1

Status
Not open for further replies.

delaap

Programmer
Jun 6, 2001
22
GB
Hi,

I'm looking to update a datetime field with the current date on a daily basis as part of a DTS package. I've tried to use the GETDATE() Function but it returns the time as well. Is there an easy way of truncating the time and just use the date for the update ?
 
This would how it would normally be done in a Select statement. Can that be done in DTS?

select convert(varchar,getdate(),103)

(for more options refer "cast and convert" in BOL.)
 
Thanks, works a treat.
I run this code iside an Execute SQL Statement Task within DTS. By the way what does the 103 do ? or how do I find out more.
 
When converting dates, the Convert() function uses a 'style number' to determine how you want the date formatted. There are a number of style numbers: 103 is dd/mm/yy. Actually, I might have thought that 112 (yyyymmdd) would be better for you.

See "Cast and Convert" in BooksOnLine for more info.
 
Thanks you have been a great help. Keep up the good work !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top