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 : 11:43:49
Hai,

I have two table,
1.select * from CC_Services

Price--Varchar
12
1212
323
12

2.select * from CC_MoneyExchange

Euro--varchar
7.4


I try below query,

select (a.Price/m.EuroExchange)
from CC_Services as a
cross join
CC_MoneyExchange as m

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


Thanks in Advance

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2009-06-15 : 11:54:06
Converting a varchar to int can be done like this:

SELECT CONVERT(int, '5')

Some days you're the dog, and some days you're the fire hydrant.
Go to Top of Page

malaytech2008
Yak Posting Veteran

95 Posts

Posted - 2009-06-15 : 12:24:15
Find here: http://msdn.microsoft.com/en-us/library/ms187928.aspx

Malay
Go to Top of Page
   

- Advertisement -