please provide me a update statement for the below sql select statement to increase the time by one hour

  • SELECT

    RiseSet.GregorianDate

    ,RiseSet.SunRise

    ,RiseSet.SunSet

    ,RiseSet.RKStart

    ,RiseSet.RKFinish

    ,RiseSet.YGStart

    ,RiseSet.YGFinish

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.SunRise + ':00.000')), 108) as SunRise

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.SunSet + ':00.000')), 108) as SunSet

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.RKStart + ':00.000')), 108) as RKStart

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.RKFinish + ':00.000')), 108) as RKFinish

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.YGStart + ':00.000')), 108) as YGStart

    ,CONVERT(CHAR(5), DATEADD(HH, 1, CONVERT(DATETIME, RiseSet.GregorianDate + ' ' + RiseSet.YGFinish + ':00.000')), 108) as YGFinish

    FROM

    dbo.RiseSet

    WHERE

    RiseSet.GregorianDate BETWEEN '2014-03-09' AND '2014-11-02'

    ORDER BY

    RiseSet.GregorianDate;

  • You want to update what?

    Without knowing what it is you wish to update we can't really help, but to add an hour to a datetime column, simply do something like:

    UPDATE dbo.SomeTable

    SET SomeColumn = DATEADD(HOUR, 1, [BasisColumn])

    WHERE ThisCondition = ThatCondidion

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • E

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply