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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Substring
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sanjay5219
Posting Yak Master

237 Posts

Posted - 08/15/2014 :  10:52:14  Show Profile  Reply with Quote
Hi All,

I have one column phone float now I have to remove 1144 from starting

I can not run substring query please suggest

9740084226
9740084227
11449964743899

gbritton
Flowing Fount of Yak Knowledge

1752 Posts

Posted - 08/15/2014 :  14:29:59  Show Profile  Reply with Quote
Why is a phone number stored as a float?


select cast(cast(11449964743899 as float) as bigint) % 11440000000000
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22772 Posts

Posted - 08/18/2014 :  05:22:37  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by gbritton

Why is a phone number stored as a float?


select cast(cast(11449964743899 as float) as bigint) % 11440000000000



This is enough


select cast(cast(11449964743899 as float) as bigint) % 10000000000

Madhivanan

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

madhivanan
Premature Yak Congratulator

India
22772 Posts

Posted - 08/18/2014 :  05:23:47  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
quote:
Originally posted by sanjay5219

Hi All,

I have one column phone float now I have to remove 1144 from starting

I can not run substring query please suggest

9740084226
9740084227
11449964743899


You should use VARCHAR datatype to store it and use right function

select right(phone,10) from table

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.08 seconds. Powered By: Snitz Forums 2000