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

Update Date/Time Field

Status
Not open for further replies.

angiem

MIS
Sep 29, 2000
116
0
0
CA
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())


Thanks

Angie
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top