Question : Datediff parameter

Hi Experts,

What is wrong with the syntax in the datediff function in this update query?
UPDATE    ActiveUsers
SET              LogOut = { fn NOW() }, TimeLogged = DATEDIFF('hh', DatetimeLogged, GETDATE())
WHERE     (UserID = 2)
I get :
 invalid parameter 1 in datediff
Regards,
JoeBo

Answer : Datediff parameter

In SQL Server 2005, do not encapsulate the hh in single quotes


UPDATE    ActiveUsers
SET       LogOut = { fn NOW() }, TimeLogged = DATEDIFF(hh, DatetimeLogged, GETDATE())
WHERE     (UserID = 2)

Random Solutions  
 
programming4us programming4us