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
 Convert Varchar to int

Author  Topic 

esambath
Yak Posting Veteran

89 Posts

Posted - 2009-06-15 : 23:32:46
Hai,

I am useing Two table

1.select * from CC_Services

Price
12
1212
323
12
12312
323


2.select * from CC_MoneyExchange

Euro
7.4



my query,
select (a.Price/m.Euro)
from CC_Services as a
cross join
CC_MoneyExchange as m

I face Error --->


Server: Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals divide, type equals varchar.

If you Know the solution replay me..Thanks in advance.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-15 : 23:40:12
use convert() to convert to integer or decimal data type before the division

convert(decimal(20,2), a.Price) / convert(decimal(20,2), m.Euro)



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

esambath
Yak Posting Veteran

89 Posts

Posted - 2009-06-15 : 23:55:11
Thanks for your Replay .it's working.
Go to Top of Page
   

- Advertisement -