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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL TEXT STRINGS 1

Status
Not open for further replies.

lairdr

Technical User
Mar 25, 2001
2
GB
I am trying to update a database and replace existing text strings. The existing text strings have & within them.
The command I am inputting is
update fieldd0300 set supplier = 'ABBOTT AND COSTELLO' where supplier like 'A & C%';
This then prompts me for a value for C which is not what I want.
I have tried using \ as a delimiter but this does not seem to work, does anyone know what I should be using.
 
You may use SET DEFINE to switch define character.
 
Thanks for the advice but it doesn't seem to work

I used
set define
then

update fieldd0300 set supplier = 'ABBOTT \& COSTELLO' where supplier like 'A \& C%';

I got a response of O rows updated although I know there many instances of the string.

I also tried using \ before and after the & but this prompted me for a value for C
 
You might try
SET ESCAPE '\'

Then try
UPDATE.....
WHERE supplier LIKE 'A \& C%';
 
SET DEFINE command defines substitution character, not escape. You may redefine & or even skip any substitution charcter at all by SET DEFINE OFF.
 
have you tried select replace..... check sql syntex to substitute values, then if it works as select you may wite a routine to update the table.
regards
 
The issue of embedded ampersands was discussed in thread186-27781. Perhaps the suggestions in that thread might help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top