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

Update Time in column

Status
Not open for further replies.

gtjr92

Programmer
May 26, 2004
96
I have a date field(starttime) that is formated date time.
2 questions
1. I did a mass update and the time in this field is all set to 00:00 for all the dates. Is there a way that I can update just the time for these fields?

2. I have another field that is an enddate column. How can I have sql look at starttime field and then add say 12 hours to the starttime and make that the end date/time?
Thanks!!
 
On 1), I don't think there's a way to just update the time without updating the Date. Unless you figure out a way with my answer to # 2.

2) Use DateAdd. An example would be:
Set EndDate = DateAdd(hh, 12, StartDate)

Look up DateAdd in BooksOnline to see all the parts you can update on the DateTime datatype. This might give you the answer to question # 1.



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
IT worked and I just used the same statement to update my starttime as well Update events
Set Starttime = DateAdd(hh,12, Starttime);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top