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

replace statment not replacing 1

Status
Not open for further replies.
Dec 31, 2004
71
GB
Hi All,
I am attempting to replace a statment in a varchar 2048 feild, I am using the below statment;

SELECT REPLACE (NOTETEXT,'internalID="CUSTOMER_NAME" attributeID="CUSTOMER_NAME" attributeType="String" attributeName="Client Name"', 'internalID="Name" attributeID="Name" attributeType="String" attributeName=""')
FROM CFG
WHERE NOTETEXT LIKE '%ALL change requests%'

The output in Query Analyzer shows it was succesfull, however when I run;

SELECT * FROM CFG
WHERE NOTETEXT LIKE '%ALL change requests%'

I find that it has not really changed the data.

Can anyone help?

Thanks
Nathan
 
Your statement is only SELECTing the replaced data. If you actually want to permanently update the data you need to use:

Code:
UPDATE CFG
SET NOTETEXT = REPLACE (NOTETEXT,'internalID="CUSTOMER_NAME" attributeID="CUSTOMER_NAME" attributeType="String" attributeName="Client Name"', 'internalID="Name" attributeID="Name" attributeType="String" attributeName=""')
WHERE NOTETEXT LIKE '%ALL change requests%'

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top