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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Appending 00 to numbers

Author  Topic 

Olad

11 Posts

Posted - 2008-10-29 : 10:07:16
I need help in appending 2 zeros (00) to telephone numbers in column which has nvarchar as a data type. I'm using SQL 2000.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-29 : 10:19:51
SELECT '00' + Col1
FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-29 : 10:20:15
UPDATE Table1
SET Col1 = '00' + Col1
WHERE Col1 NOT LIKE '00%'


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-10-29 : 10:36:00
[code]select stuff([column],1,0,'00') as mycolumn from Your_table[/code]
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-10-29 : 12:39:55
Peso...
Appending = After
Prepending = Before

???
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-29 : 13:24:27
I think he need to "internationalize" his phone numbers, thus putting 00 in front of telephone numbers.
But then again, I may be wrong.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Olad

11 Posts

Posted - 2008-10-30 : 00:03:57
quote:
Originally posted by Peso

UPDATE Table1
SET Col1 = '00' + Col1
WHERE Col1 NOT LIKE '00%'


E 12°55'05.63"
N 56°04'39.26"




It is true I would like to internationalise our outgoing calls. Our softswitch was leaving the prefix of "some" countries between 01/10/2008 and 05/10/2008 and I would like to add 2 zeros manually for proper billing. The above will add '00' at the front of every number. But I want to add 00 to some numbers that start with, for example, 97, 1, etc.

Go to Top of Page

Olad

11 Posts

Posted - 2008-10-30 : 01:11:23
quote:
Originally posted by AndrewMurphy

Peso...
Appending = After
Prepending = Before

???



I beleive i wanted to say "To prefix or add '00' to the beginning of the phone numbers.

Go to Top of Page

Olad

11 Posts

Posted - 2008-10-30 : 01:19:30
I think I got it with your help.

UPDATE CALLHIST
SET Col1 = '00' + col1
WHERE Col1 LIKE '97%' and [DATE] BETWEEN '20081001' AND '20081005'

Thanks to all those who replied. I appreciate your help.

Go to Top of Page
   

- Advertisement -