Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: Database: MS SQL Server
 MS SQL Query help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Lon2
Junior Member

USA
151 Posts

Posted - 27 February 2009 :  15:25:34  Show Profile
I had some old icon images in topics and made a mistake in removing just the image URL without the image tags. For example, I had this:

[img ]h11p://www.someurl.com/images/thisimage.gif[/img]

And ran a query to remove this (not thinking about the tags):

h11p://www.someurl.com/images/thisimage.gif

So now I'm left with empty tags:

[img ][/img]

How would I write a query to remove JUST empty image tags? I was thinking this:

UPDATE FORUM_REPLY
SET R_MESSAGE=REPLACE'[img ][/img]',''

But will it remove image tags around images also?<

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 27 February 2009 :  18:38:18  Show Profile  Send ruirib a Yahoo! Message
http://msdn.microsoft.com/en-us/library/ms186862.aspx

UPDATE FORUM_REPLY
SET R_MESSAGE=REPLACE(R_MESSAGE,'[img][/img]','')

<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 27 February 2009 :  21:57:24  Show Profile
Thanks Rui!

Also, if I have text in replies that is surrounded by font size tags and I want to remove the font size tags without disturbing the text, and the text can be anything and all different, how would I go about doing this? Is there a wildcard that can be used and will it work for any character length between the two font size tags?

UPDATE FORUM_REPLY
SET R_MESSAGE=REPLACE(R_MESSAGE,'[size=l]don't want this effected[/size=l]','')

(Want to remove only the red font size tags shown above.)<
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 27 February 2009 :  22:25:44  Show Profile  Send ruirib a Yahoo! Message
Replace each of the tags with each own SQL statement, that is, one update for [size=..] and another update for [/size].<


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Lon2
Junior Member

USA
151 Posts

Posted - 28 February 2009 :  00:28:16  Show Profile
Worked great, thanks again Rui!<
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07