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
 Sql Server2008 - Select Query Problem ?

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2010-09-18 : 02:19:48
Hi,

My Query :

"select m.req_number,(0+m.quantity) as req_quantity from matrequest m"

The above select Query from table MatRequest and the field Quantity is varchar(15).

But the problem is when the data is like decimal its giving error
"converion failed when converting the varchar value '2.5' to data type int."

So how to solve this problem?

Thanks for the Ideas


Paramu @ PARANTHAMAN

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-09-18 : 05:54:48
select
m.req_number,
convert(decimal(12,2),m.quantity) as req_quantity
from matrequest m


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2010-09-18 : 06:26:21
Thanks WebFred ! You guided me Lot! Many things I learned from you !
Thanks

Paramu @ PARANTHAMAN
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-09-18 : 07:24:59
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -