I need to update a date/time field with a number of hours held in another table(appconfig.apptime) I have tried this code but it errors about the other table.
UPDATE customer
SET appdate = dateadd(h,appconfig.apptime,getdate())
You want to update all the records in this table? The simplest way would be to grab the apptime in to a variable and then use the variable to update the other table. Like this:
Code:
Declare @AppTime Integer
Select @AppTime = AppConfig.AppTime
From AppConfig
UPDATE customer
SET appdate = dateadd(h,[!]@AppTime[/!],getdate())
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.