Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More than 1 replace in a column. 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi Guys,
How do I do more than 1 replace in a column, I've tried various versions of this:

REPLACE(dbo.tbltruststaff.JobFamily, 'Nursing / Midwifery', 'Nursing and Midwifery') & REPLACE(dbo.tbltruststaff.JobFamily, 'Nursing/Midwifery', 'Nursing and Midwifery')

but cant find the right syntax.
 
Just use the function twice or more8
Code:
REPLACE(
        REPLACE(dbo.tbltruststaff.JobFamily,
                'Nursing / Midwifery',
                'Nursing and Midwifery'),
        'Nursing/Midwifery',
        'Nursing and Midwifery')
But why twice the same?

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
You need to nest the REPLACE statements:

Code:
REPLACE(REPLACE(REPLACE(str1, str2, str3), str4, str5), str6, str7)

~LFCfan

 

BBorissov

There is a space before and after the forward slash in 1 of them.


Thanks guys those work great.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top