Conversion of data type problem | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Conversion of data type problem

While uploading the data into our production server, i am getting error like "error converting varchar to float".
Can some1 suggest how to resolve this kind of issues.
I’ve moved to relevant forum.
Luis Martin
Moderator
SQL-Server-Performance.com All in Love is Fair
Stevie Wonder
All postings are provided “AS IS” with no warranties for accuracy.
Can you post and example of original data to upload?
Luis Martin
Moderator
SQL-Server-Performance.com All in Love is Fair
Stevie Wonder
All postings are provided “AS IS” with no warranties for accuracy.
error says that you are trying to insert some alphanumeric values into numeric column.
You need to find out those record and if those record contains numeric values then those can be implicitly converted else explicitly using convert and cast function.
example:
select convert(int,’123′)

As has been said, it’s likely that you have "bad" data in the data you’re trying to upload. One typical mistake in this regard is the import of string data like 123,45 into into a column of type DECIMAL or FLOAT. This will, for example, cause your error. In order to prevent it, you need to REPLACE(123,45, ‘,’, ‘.’) the comma. SQL Server is, after all, an US American based system and the guys over there unfortunately use the dot as decimal separator. —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
]]>