tags:

views:

86

answers:

2

in MS access i ve a column in time format n i would like add 24 hrs for each row of that column .....

can any one please suggest a query for it in sql.......

+4  A: 

You can use the following query:

update table1 set dateColumn = dateadd("h",24,datecolumn)

or you can add 1 day to the date because 1 day = 24 hour.

update table1 set dateColumn = dateadd("d",1,datecolumn)
Wael Dalloul
+3  A: 

Internally date/times are represented as a double where the signed integer part is the number of days since December 30th 1899 and the fractional part is the unsigned offset of hours within the day.

So you can update you column’s value with the following statement.


update table1 set dateColumn = dateColumn + 1

This statement is pretty safe as it is. If in the future you need update with something that is not multiple of 24 hours (or the decimal part of the double), you’ll better use dateadd as stated by Wael Dalloul.

More details and pitfalls can be found an Eric Lippert’s excellent blog posts:

Alfred Myers