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 2005 Forums
 Transact-SQL (2005)
 Datetime + 30 mins (UPDATE)

Author  Topic 

PBoy
Starting Member

22 Posts

Posted - 2011-02-22 : 14:57:31
Hi All,

This may be a daft question but is there a simple way to update a datetime column to add 30 mins to what already exist in the column?

For example update column "Next Run" with datetime 2011-02-22 22:15:00.000 with another 30 mins to the value so it updates to 2011-02-22 22:45:00.000.

Any help would be great :)

Cheers
PBoy

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-02-22 : 15:02:31
UPDATE yourTable
SET [Next Run] = dateadd(minute,30,[Next Run])

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

PBoy
Starting Member

22 Posts

Posted - 2011-02-22 : 15:07:01
Brilliant what I wanted thank you jimf

Cheers
Patrick
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-02-22 : 15:09:24
You're Welcome!

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -