January 21, 2009 at 10:17 am
I've searched on the net with no luck so I'm going to post this one here.
I took a 2000 database and brought it into 2005. It doesn't matter if it's in 80 or 90 compatibility as to the error.
"Syntax error converting the varchar value 'A' to a column of data type int."
I understand that this could be a datatype mismatch, but isn't that something that would have popped up in 2000?
MCITP, Database Administrator
A hodgepodge of Information Technology and Life
LinkedIn Profile
My Twitter
January 21, 2009 at 10:24 am
Jason Crider (1/21/2009)
I've searched on the net with no luck so I'm going to post this one here.I took a 2000 database and brought it into 2005. It doesn't matter if it's in 80 or 90 compatibility as to the error.
"Syntax error converting the varchar value 'A' to a column of data type int."
I understand that this could be a datatype mismatch, but isn't that something that would have popped up in 2000?
Only problem I see here is a lack of context. Where are you getting this error? In a query, what? We really need more information to be able to help you out.
January 21, 2009 at 10:32 am
I apologize for not being more specific. I've just found what seems to be a fix for it but I hope there's a global change.
I'll be a little more specific but I can't put the whole thing on here because I'd have to doctor it too much.
Let's say we are talking about a view.
When the following is in the WHERE clause it breaks:
AND f.FacilityTypeCode = 1
When the following is in the WHERE clause it works:
AND f.FacilityTypeCode = '1'
The code without the brackets worked in SQL 2000 but it doesn't work in 2005. Is there some type of global fix for that aside from changing all the referrences in the code?
MCITP, Database Administrator
A hodgepodge of Information Technology and Life
LinkedIn Profile
My Twitter
January 21, 2009 at 10:41 am
Jason Crider (1/21/2009)
I apologize for not being more specific. I've just found what seems to be a fix for it but I hope there's a global change.I'll be a little more specific but I can't put the whole thing on here because I'd have to doctor it too much.
Let's say we are talking about a view.
When the following is in the WHERE clause it breaks:
AND f.FacilityTypeCode = 1
When the following is in the WHERE clause it works:
AND f.FacilityTypeCode = '1'
The code without the brackets worked in SQL 2000 but it doesn't work in 2005. Is there some type of global fix for that aside from changing all the referrences in the code?
Based on the above, it is apparent that there are non-numeric values in f.FacilityTypeCode. In the first WHERE clause this is failing as it is trying to convert the value to an integer. The only real fix is the one you found, putting single quotes around the 1 thereby making it a character constant instead of an integer constant.
Why it worked in SQL Server 2000, I couldn't tell you, unless the non-numeric value(s) was entered after to move to SQL Server 2005.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply