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

UPDATE fails...

Status
Not open for further replies.

Quehay

Programmer
Feb 6, 2000
804
US
This fails:
[tt]
update reports
set page1_review_date = '11/14/2002',
recommendation_blood_pressure='bp rec',
recommendation_antiprotein='ap rec',
recommendation_protein_intake='bp rec'
where visit_guid='{F2482D81-95A4-11D6-987F-064514469200}'[/tt]

With this message:

Server: Msg 295, Level 16, State 3, Line 1
Syntax error converting character string to smalldatetime data type.

It updates when only the date field is attempted, e.g.:

[tt]update reports
set page1_review_date = '11/14/2002'
where visit_guid='{F2482D81-95A4-11D6-987F-064514469200}'[/tt]

This is RIDICULOUS! Any hints as to why SQL Server can't handle this standard UPDATE?

Thanks!
 
Maybe because you have more than just the datetime field. MS Sql will usually convert datetimes for you, but not sure when you have other fields if the convert is getting confused or what. Try this:

update reports
set page1_review_date = convert(smalldatetime,'11/14/2002',101),
recommendation_blood_pressure='bp rec',
recommendation_antiprotein='ap rec',
recommendation_protein_intake='bp rec'
where visit_guid='{F2482D81-95A4-11D6-987F-064514469200}'

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top