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
 General SQL Server Forums
 New to SQL Server Programming
 Adding a prefix to a set of fields

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2009-11-26 : 10:21:35
Hi Guys,

I would like to add 246 in front all of each telephone number in the database. How do you go about doing this?

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-11-26 : 11:36:40
that depends on how you are storing them.

What's the data type of the column in question?

If you are storing them as VARCHAR's then you'd do something like:

UPDATE <yourTable> SET
<TEL NUMBER COLUMN> = '246' + <TEL NUMBER COLUMN>

(if you want to do all the rows)


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -