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
 Find and Replace

Author  Topic 

nirene
Yak Posting Veteran

98 Posts

Posted - 2008-01-23 : 23:33:35
Hello All,
I have a master file with

Slcode Sldesc
S0001 Furniture & Fittings
S0002 Investments
S0003 Coolie & Cartage

I want to find the ampersand character in between and replace with and.

Nirene

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-01-23 : 23:35:46
You like to replace it in sql table or in text file?
Go to Top of Page

nirene
Yak Posting Veteran

98 Posts

Posted - 2008-01-23 : 23:49:33
In the same sql table
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-24 : 00:03:02
use REPLACE([columnname],'&','and') like
declare @table table
( nam varchar(30)
)
insert @Table
select 'sunil & santosh'
select Replace(nam,'&','and') [name] from @Table
Go to Top of Page

raaj
Posting Yak Master

129 Posts

Posted - 2008-01-24 : 10:59:41
try this:
create table abc (slcode varchar (10), sldesc varchar (50))

insert into abc values ('S0001','Furniture & Fittings')
insert into abc values ('S0002','Investments')
insert into abc values ('S0003','Coolie & Cartage')

select * from abc

update abc
set sldesc = replace (sldesc,'&','and')

select * from abc
Go to Top of Page
   

- Advertisement -