September 8, 2009 at 6:17 am
Hello,
Please let me know how to retain the + symbol and truncate the decimals
from the following. i tried with round and celing but of no use.
The datatype is varchar.
Example 1: +9966557785.0000000000000000
Example 2 : +9999665545.0000000000000000
Regards,
Sirish
September 8, 2009 at 6:22 am
Possibly the easiest way would be
select convert(bigint,+9966557785.0000000000000000)
Depends on what you want to do with the number after this really though.
September 8, 2009 at 6:46 am
SELECT SUBSTRING(phonenumber,1,charindex('.',phoneNumber)-1) from table
September 8, 2009 at 1:48 pm
Sirish likely has the best answer for fixing currently incorrect data, the real issue is to fix the data entry application.
Another option in SQL Server if the # of characters to the left of the decimal are consistent is this:
SELECT Left('+9999665545.0000000000000000', 11)
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply