SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 to_number in sqlserver
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

psangeetha
Yak Posting Veteran

95 Posts

Posted - 07/01/2008 :  10:34:47  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2869 Posts

Posted - 07/01/2008 :  10:42:03  Show Profile  Reply with Quote
CONVERT(int,qty)
I am assuming that qty are whole numbers

Jim
Go to Top of Page

psangeetha
Yak Posting Veteran

95 Posts

Posted - 07/01/2008 :  10:44:43  Show Profile  Reply with Quote
Yes, thanks Jim
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22761 Posts

Posted - 07/01/2008 :  15:59:39  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000