Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 converting the varchar value '52.91'

Author  Topic 

johnjasper
Starting Member

4 Posts

Posted - 2007-03-18 : 20:58:56
Hi,
I am trying ot do a count with a clause like this "amtdue >=10000 and amtdue <=25000" --- I get and error that says "Syntax error converting the varchar value '52.91' to a column of data type int" There are 20 million records in the table - this field is formatted as a varchar - can someone help me find the problem?

Thanks

John

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-18 : 21:33:08
Try

amtdue >=10000.0 and amtdue <=25000.0



KH

Go to Top of Page

johnjasper
Starting Member

4 Posts

Posted - 2007-03-18 : 21:37:26
I did 2 things to get my query to run,
1. I did "set amtdue= 0 WHERE ISNUMERIC(amtdue)=0"
2. Then I did "(cast(claimfile.amtdue as decimal) >=100.00 and cast(claimfile.amtdue as decimal) <=250.00))"

It worked

Thank you khtan
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-18 : 21:50:32
Final step to fixed it once and for all, use correct data type for your amtdue. Like decimal / numeric


KH

Go to Top of Page
   

- Advertisement -