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 2005 Forums
 Transact-SQL (2005)
 Adding a + in front of telephone numbers

Author  Topic 

KingCarlos
Yak Posting Veteran

74 Posts

Posted - 2010-01-12 : 23:09:23
I have the following set of data


Row # Phone_number
1 11111
2 22222
3 33333

How to I update the phone number to have a + in front of each record in one hit.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-01-12 : 23:38:35
update table_name set Phone_number='+'+Phone_number

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-12 : 23:39:56
Assuming the column is a character data type such as varchar:

UPDATE YourTable
SET Phone_Number = '+' + Phone_Number

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

KingCarlos
Yak Posting Veteran

74 Posts

Posted - 2010-01-12 : 23:43:55
Thanks Guys ! that worked, wow that was simple,
Go to Top of Page
   

- Advertisement -