By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

Remove all after certain character

100+
P: 229
Hi, I wonder if anyone could help. I have been hacked and one field in my database has had html and links added after the original content.


http://www.website.com</title><style>.ajbv{position:absolute;clip:rect(481 px,auto,auto,446px);}</style><div class=ajbv><a href=http://ma

I need to remove everything after and including the title to leave only
http://www.website.com

Thanks for any help
Richard
Apr 27 '15 #1
Share this Question
Share on Google+
2 Replies


100+
P: 229
hi, I solved it like this in the nd so thanks.

Expand|Select|Wrap|Line Numbers
  1. UPDATE tbl
  2. SET website= LEFT(website, CHARINDEX('<', website) - 1)
  3. WHERE CHARINDEX(';', website) > 0 
Thanks
Richard
Apr 27 '15 #2

Expert 100+
P: 1,043
What?
You search for a ';', and replace anything before a '<'
That seems to be not the correct way!
(but might give correct results in this situation)

Secondly, restoring a backup might even be safer, after all someone changed thing in your system, and they might have change more than just this column.
Apr 27 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.