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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Tags in Text Field issue

Author  Topic 

tking1
Starting Member

22 Posts

Posted - 2010-09-22 : 13:07:10
I have an nvarchar field (which is rich text in the app) that sometimes has an email that was pasted in it by a user. When my query pulls the field with an email in it, it shows the tags <div> & </div> around the email portion of the text.

Problem with that is when I shoot my results to a file and open with Excel, the <div> text </div> is thrown into a separate row, rather than being included in the field of the appropriate entry.

How can I prevent the tags from causing this behavior?

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2010-09-22 : 15:01:16
When I use a rich text box, I strip all formating prior to sending it to the db. You can just select the text of the rich text box without including the formating for rtf.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-09-23 : 05:08:37
it you want to just remove the <div> </div> tags from the existing text (and it's not a BLOB datatype)

You can do:

UPDATE <table> SET [column] = REPLACE(REPLACE([column], '<div>', ''), '</div>', '')



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

tking1
Starting Member

22 Posts

Posted - 2010-09-23 : 09:02:32
Awesome, thanks!
Go to Top of Page
   

- Advertisement -