Take the 2-minute tour ×

I am updating records. But It gives error

Error converting data type varchar to numeric

Here is the query:

UPDATE tbl_Contract_QutationDetails SET DCont_Discount_Var=23 
WHERE DCont_Qty_Code_Var='BLDG/CNQT/11-12/101' AND DCont_Contractor_Code_Var='CNTT1001'

Please give me solution.

share|improve this question

closed as not constructive by marc_s, dove, J. Steen, PearsonArtPhoto, Rob Nov 23 '12 at 11:02


Your field DCont_Qty_Code_Var has qty in it which seems to mean "quantity". Is that field numeric by any chance? –  CyberDude Nov 23 '12 at 7:27
you are trying to convert varchar to numeric in your query..check its design and then update values accordingly. –  Saasu Ganesan Nov 23 '12 at 7:29
pls post your table definition –  jeroenh Nov 23 '12 at 7:38
Nobody can help you if you want them to predict your table structure –  patrick choi Nov 23 '12 at 8:07
Either DCont_Qty_Code_Var or DCont_Contractor_Code_Var is a numeric column in your database, and you're trying to parse a string into it. –  Henk Mollema Nov 23 '12 at 8:14

2 Answers 2

I would suggest you first check the column definitions against the data youre passing them and them.

What the error is saying (assuming its triggered by that piece of sql) is that there is some number column youre working with but youre passing the data as a string and that string doesnt represent a number. So,


Are you sure DCont_Discount is a number? (Seems the answer is yes)


Are you sure DCont_Qty_Code_Var is a string?


Are you sure DCont_Contractor is defined as string?

One of these columns is defines as something numeric, i'd wager

share|improve this answer
I got the solution actually their are 2 columns with the name DCont_Qty_Code_Var and DCont_Qty_Code_Series_Var .I want to refer DCont_Qty_Code_Series_Var but by mistake i was using another column...Thanks to all for helping me.. –  Suhani Patil Nov 23 '12 at 9:22

My guess is DCont_Discount_Var=23 should be DCont_Discount_Var='23'

share|improve this answer
Unlikely. If that column was the issue, it would be attempting to convert a numeric to varchar (which should always succeed, unless there's a length issue) whereas the error message says the problem occurs trying to convert a varchar to numeric. –  Damien_The_Unbeliever Nov 23 '12 at 8:14
