Reputation: 93
When I run my query:
UPDATE oms.Document_Latest
SET size ='54324', CheckInBy = 'Anshul123',
Status ='checkedin', CheckOutBy = 'NULL',
CheckInOn = '4/28/2016 1:45:36 PM', CheckOutOn = 'NULL'
WHERE (Id = '1')
Datatype of columns are given in image which is attached with this question
I get this error:
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.
Please help me find the reason why I get this error while execute this query.
Thanks
Upvotes: 2
Views: 336
Reputation: 9053
You receive an error that because you trying to update CheckOutOn
column of datatype DATETIME
with string 'NULL'
. You have to remove quotes ''
from NULL
in following:
UPDATE oms.Document_Latest
SET size ='54324',
CheckInBy = 'Anshul123',
Status ='checkedin',
CheckOutBy = NULL,
CheckInOn = '4/28/2016 1:45:36 PM',
CheckOutOn = NULL
WHERE (Id = '1')
Upvotes: 6