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

SQL statement to update multiple rows at once - spelling error?

Status
Not open for further replies.

kloner

Programmer
May 15, 2000
79
AU
Hi all.

What I have is 200 rows of data in the one column. The data is a wddx packet eg.

Table : Objects
Column : data

<wddxPacket version='1.0'><header></header><data><struct><var name='CACHEPAGES'><string>1</string></var><var name='LOGCACHEDOBJECTS'><string>thisword</string></var><var name='LOGPAGES'><string>1</string></var><var name='LOGSECTION'><string>1</string></var><var name>


What I want to do for example is run a query that will find 'thisword' in the string, and update it to read 'ThisWord'.

Any ideas on the SQL for this?

What I did have was :

update objects
set data='thisword'
where data like '%ThisWord%'

all that happened was every record was wiped and only contained 'ThisWord'. Big problem!

Thanks.



kloner


 
What I want to do for example is run a query that will find 'thisword' in the string, and update it to read 'ThisWord'.
update objects set data='thisword'
where data like '%ThisWord%'


Your goal and your command are at odds; I'm not sure which is correct, but using your comment as the ideal, try this:

[tt]update objects
set data = 'ThisWord'
where data like '%thisword%'[/tt]

Since you've encountered data loss problems, try it as a select first to see what you get, as in:

[tt]select * from objects
where data like '%thisword%'[/tt]

Robert Bradley

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top