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
 to_number in sqlserver

Author  Topic 

psangeetha
Yak Posting Veteran

95 Posts

Posted - 2008-07-01 : 10:34:47
Hi all, I created a view in oracle like below and will have to create the same in sqlserver database.

create or replace force view text_vw (itm,
sile,
eqty,
)

as
select itm,sile,to_number(qty)
from text
where code in (2,3);


I used to_number in oracle to convert a column value from string to numeric. Please help on how I can do this in sqlserver.
Thanks

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-07-01 : 10:42:03
CONVERT(int,qty)
I am assuming that qty are whole numbers

Jim
Go to Top of Page

psangeetha
Yak Posting Veteran

95 Posts

Posted - 2008-07-01 : 10:44:43
Yes, thanks Jim
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-01 : 15:59:39
Always use proper datatype to store data. That would avoid unneccessary convertions

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -