Click here to Skip to main content
15,921,463 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
convert (int, T0.U_INRPRICE ) as result


when try to convert it give below error

Conversion failed when converting the nvarchar value '82,236.44' to data type int.

pls advice hence new to sql.

thx in advance
Posted
Updated 24-Oct-15 1:00am
v2

1 solution

The error message is pretty obvious:
Conversion failed when converting the nvarchar value '82,236.44' to data type int.

82,236.44 isn't an integer value.

The problem is that you have a design error: your database contains numeric values which you have stored in a string based column (or several columns with the same problem).
The solution is to create a new table, with the correct datatypes, and write some C# or VB (or whatever) code to convert and move your existing data into the new table before replacing the old one once you have sorted out the code which inserts into it.

Otherwise this problem will come back, again, and again, and again...and it gets harder to sort out the longer you leave it as the size of the data you need to correct increases - and the chances of you being able to work out the correct values decreases.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900