Data Conversion | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Data Conversion

Hello, Can’f figure out this conversion issue. Please Help! Here is the query:
select CONVERT(money, Amount) as amount from
Temp_Table
I need to convert column "Amount" which is varchar(50) datatype to a column of datatype money. I am getting the following errror:
"
Server: Msg 235, Level 16, State 1, Line 1
Cannot convert a char value to money. The char value has incorrect syntax." Any ideas?

I would guess that you have a value in the Amount field in Temp_Table that has some kind of character in it that is not numeric. You could try something like this to find the offending row: SELECT *
FROM Temp_Table
WHERE ISNUMERIC(Amount) = 0 This should find all rows that will not convert to money so you can fix them. I did some testing and noticed that ISNUMERIC will evaluate to true even if there is a ‘$’ in the data.
]]>