SQL SERVER – 2005 – UDF – User Defined Function to Strip HTML – Parse HTML – No Regular Expression

One of the developer at my company asked is it possible to parse HTML and retrieve only TEXT from it without using regular expression. He wanted to remove everything between < and > and keep only Text. I found question very interesting and quickly wrote UDF which does not use regular expression.

Following UDF takes input as HTML and returns TEXT only. If there is any single quotes in HTML they should be replaced with two single quotes (not double quote) before it is passed as input to function.

CREATE FUNCTION [dbo].[udf_StripHTML]
(@HTMLText VARCHAR(MAX))
RETURNS VARCHAR(MAX)
AS
BEGIN
DECLARE
@Start INT
DECLARE
@End INT
DECLARE
@Length INT
SET
@Start = CHARINDEX('<',@HTMLText)
SET @End = CHARINDEX('>',@HTMLText,CHARINDEX('<',@HTMLText))
SET @Length = (@End - @Start) + 1
WHILE @Start > 0
AND @End > 0
AND @Length > 0
BEGIN
SET
@HTMLText = STUFF(@HTMLText,@Start,@Length,'')
SET @Start = CHARINDEX('<',@HTMLText)
SET @End = CHARINDEX('>',@HTMLText,CHARINDEX('<',@HTMLText))
SET @Length = (@End - @Start) + 1
END
RETURN
LTRIM(RTRIM(@HTMLText))
END
GO

Test above function like this :

SELECT dbo.udf_StripHTML('<b>UDF at SQLAuthority.com </b><br><br><a href="http://www.SQLAuthority.com">SQLAuthority.com</a>')

Result Set:

UDF at SQLAuthority.com SQLAuthority.com

If you want to see this example in action click on Image. It will open large image.

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

77 thoughts on “SQL SERVER – 2005 – UDF – User Defined Function to Strip HTML – Parse HTML – No Regular Expression

  1. Hi ,

    Really fantastic and jore hey, but I tried this in sql server query analyzer…

    I got the errors like this :

    Server: Msg 170, Level 15, State 1, Procedure udf_StripHTML, Line 2
    Line 2: Incorrect syntax near ‘MAX’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 11
    Must declare the variable ‘@HTMLText’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 12
    Must declare the variable ‘@HTMLText’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 17
    Must declare the variable ‘@HTMLText’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 18
    Must declare the variable ‘@HTMLText’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 19
    Must declare the variable ‘@HTMLText’.
    Server: Msg 137, Level 15, State 1, Procedure udf_StripHTML, Line 22
    Must declare the variable ‘@HTMLText’.

    Send the remedy by query

    With regards…

    Wilson Gunanthi . J

    • Please help to remove html tags while searching text using Full text search.

      column questiontext value = ‘Which appears to be closest to the measure’

      CREATE TABLE [dbo].[Question](
      [QuestionText] [nvarchar](max) NULL
      )

      insert into Question values ( ‘Which appears to be closest to the measure’)

      select * from question where CONTAINS(questiontext, ‘”appears to be closest”‘)

      but it not returning value

      Kindly help

      Thanks in advance
      karthik

  2. Wilson Gunanithi . J
    you are getting an error coz of copy paste

    you need to replace the ‘ in your text when you copy paste.

  3. oops you are using sql server 2000 and he is using 2005
    so you cannot use varchar(max) which is only for 2005.

    Replace varchar(max) with varchar(8000) and you will get rid of errors.

    sometimes the ‘ marks are not copied properly thats what I thought initially. please who post these articles should point out for which version this is compatible with.

  4. Does this code allow for HTML characters like the non-breaking space? &nbsp and/or other HTML encoded characters ?

    Thanks
    Tim

  5. Hi Tim,

    It does not allow those chars yet. It removes everything between “greater than” and “lesser than” sign.

    Regards,
    Pinal Dave (SQLAuthority.com)

  6. I tried the modifyed code from Lazy coder’s site and the result shows the CHAR(13) + CHAR(10) in the data instead of a BR.. any way to change that?

  7. Hi Dave,

    Thanks for nice example. I’ve also as a Lazy Coder wanted just a little bit more from the function. Looking into his code – seems he’s got small mistake – replacing < and > before actually stripping the HTML tags out will result in a different result then it could actually be, i.e.:
    ‘Check out the content: And here should be the end’
    and
    ‘Check out the content: And here should be the end’

    Here is my version – a bit modified, but does same functionality:

    CREATE FUNCTION [dbo].[uf_strip_html] (
    @stringWithHTML varchar(max)
    ) RETURNS varchar(max)
    AS
    BEGIN
    /* first part is to replace HTML entities with appropriate (for my needs) characters */
    – replacing & with &
    set @stringWithHTML = replace(@stringWithHTML, ‘&’, ‘&’);
    – replacing   with space
    set @stringWithHTML = replace(@stringWithHTML, ‘ ‘, ‘ ‘);
    – replacing with space – I don’t need to count these ones
    set @stringWithHTML = replace(@stringWithHTML, ”, ‘ ‘);

    declare @start int, @end int;
    set @start = charindex(”, @stringWithHTML);

    – by now should already have the text with almost clean html tags and need to exctract content between those
    while (@start > 0 and @end > 0)
    begin
    set @stringWithHTML = stuff(@stringWithHTML, @start, @end – @start + 1, ”);
    set @start = charindex(”, @stringWithHTML);
    end;

    – removing front/trailing spaces if any
    set @stringWithHTML = ltrim(rtrim(@stringWithHTML));

    /* replacing these entities just now in order not to strip those during text extraction */
    – replacing < with <
    set @stringWithHTML = replace(@stringWithHTML, ‘<’, ‘
    set @stringWithHTML = replace(@stringWithHTML, ‘>’, ‘>’);

    RETURN @stringWithHTML;
    END

    Thanks again,
    Vlad

  8. P.S. Seems that the form for comment submission modified the characters within the quotes. I’ll try to include the text again – please update the previous posting if possible and remove that one.

    examples:
    `Check out the content: And here should be the end`
    `Check out the content: And here should be the end`

    and function:

    CREATE FUNCTION [dbo].[uf_strip_html] (
    @stingWithHTML varchar(max)
    ) RETURNS varchar(max)
    AS
    BEGIN
    /* first part is to replace HTML entities with appropriate (for my needs) characters */
    – replacing & with &
    set @stingWithHTML = replace(@stingWithHTML, `&`, `&`);
    – replacing   with space
    set @stingWithHTML = replace(@stingWithHTML, ` `, ` `);
    – replacing with space – I don`t need to count these ones
    set @stingWithHTML = replace(@stingWithHTML, “, ` `);

    declare @start int, @end int;
    set @start = charindex(“, @stingWithHTML);

    – by now should already have the text with almost clean html tags and need to exctract content between those
    while (@start > 0 and @end > 0)
    begin
    set @stingWithHTML = stuff(@stingWithHTML, @start, @end – @start + 1, “);
    set @start = charindex(“, @stingWithHTML);
    end;

    – removing front/trailing spaces if any
    set @stingWithHTML = ltrim(rtrim(@stingWithHTML));

    /* replacing these entities just now in order not to strip those during text extraction */
    – replacing < with <
    set @stingWithHTML = replace(@stingWithHTML, `<`, `
    set @stingWithHTML = replace(@stingWithHTML, `>`, `>`);

    RETURN @stingWithHTML;
    END
    go

  9. Hi,

    Here i am update this query for removing style & script….

    Just replacing chars with blank between this TAG’s [] – [] & [<script *] – []

    Alter FUNCTION [dbo].[udf_StripHTML]
    (@HTMLText VARCHAR(MAX))
    RETURNS VARCHAR(MAX)
    AS
    BEGIN
    DECLARE @Start INT
    DECLARE @End INT
    DECLARE @Length INT

    SET @Start = CHARINDEX(”,@HTMLText)
    SET @End = (len(”)-1)+CHARINDEX(”,@HTMLText,CHARINDEX(”,@HTMLText))
    SET @Length = (@End – @Start) + 1
    WHILE @Start > 0 AND @End > 0 AND @Length > 0
    BEGIN

    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(”,@HTMLText)
    SET @End = (len(”)-1) + CHARINDEX(”,@HTMLText,CHARINDEX(”,@HTMLText))
    SET @Length = (@End – @Start) + 1
    END

    SET @Start = CHARINDEX(‘<script',@HTMLText)
    SET @End = (len('’)-1)+CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0 AND @End > 0 AND @Length > 0
    BEGIN

    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(‘<script',@HTMLText)
    SET @End = (len('’)-1) + CHARINDEX(”,@HTMLText,CHARINDEX(‘<script',@HTMLText))
    SET @Length = (@End – @Start) + 1
    END

    SET @Start = CHARINDEX('’,@HTMLText,CHARINDEX(‘ 0 AND @End > 0 AND @Length > 0
    BEGIN
    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘<',@HTMLText))
    SET @Length = (@End – @Start) + 1
    END

    RETURN LTRIM(RTRIM(@HTMLText))
    END
    GO

  10. Nice solution, i have been searching for something that remove the html code embbebed in a string, you usually think in a complex solution, i thougth to solve this using regular expresions, but this is a easy and beauty way to do it.

    Thanks and regards from Mexico.

  11. The code works great if I use the function in Query Analyzer but if I use it as part of a query in Report Builder 2.0 all returned fields are blank.
    Any idea what Reporting Services is doing that removes all the data?

  12. Great Article. Was very helpful and worked for me.

    Though in my custom function i have to write code to take care of &amp, &nbsp characters of HTML.

  13. Dear Pinal

    I have Arabic data enclosed in my DB with html tags.

    Example:
    25/10/2010- إنتظار مدير أي تي ليتابع تنفيذ المشروع وجاري البحث

    But when use this function it gives me result as below:
    25/10/2010- ?????? ???? ?? ?? ?????? ????? ??????? ????? ?????

    But it’s working for english datas…Please help. I hv given nvarchar(max) and using sql server 2005.

  14. Hi Pinal,

    Great Solution but I could not understand why you used STUFF function instead of replace. Like in Stuff you need to do the looping but like removing we can just use
    replace(”, CHAR(13)+CHAR(10)) simply…

    Wjhat do you say??

  15. I have used this one and working properly…

    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    go

    CREATE FUNCTION [dbo].[udf_ConvertHTML2Text]
    (@HTMLText varchar(MAX))
    RETURNS varchar(MAX)AS

    BEGIN

    DECLARE @Start int
    DECLARE @End int
    DECLARE @Length int

    –Replace single quote with two single quotes

    SET @HTMLText = replace(@HTMLText,CHAR(39),””)

    –Replace &amp as &
    SET @Start = CHARINDEX(‘&’, @HTMLText)
    SET @End = @Start + 4
    SET @Length = (@End – @Start) + 1

    WHILE (@Start > 0 AND @End > 0 AND @Length > 0)
    BEGIN
    SET @HTMLText = STUFF(@HTMLText, @Start, @Length, ‘&’)
    SET @Start = CHARINDEX(‘&’, @HTMLText)
    SET @End = @Start + 4
    SET @Length = (@End – @Start) + 1
    END

    –Replace &lt with <
    SET @HTMLText = REPLACE (@HTMLText, '<','
    SET @HTMLText = REPLACE (@HTMLText, ‘>’,’>’)
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘‹’,’<')
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘›’,’>’)
    –Replace &nbsp with space
    SET @HTMLText = REPLACE (@HTMLText, ‘ ‘,’ ‘)
    – Replace any tags with a newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10))
    – Replace any \t with a space
    SET @HTMLText = REPLACE (@HTMLText, ‘\t’,’ ‘)
    – Replace any tags with a newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10))
    – Replace any \n with a newline
    SET @HTMLText = REPLACE (@HTMLText, ‘\n’,CHAR(13)+CHAR(10))
    – Replace any tags with a newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10))
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10))
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10))
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10))
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ”,CHAR(9))
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘•’,’*’)
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘™’,’(tm)’)
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘⁄’,’/’)
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘©’,’(c)’)
    – Replace any tags with two newline
    SET @HTMLText = REPLACE (@HTMLText, ‘®’,’(r)’)

    –want to keep mail addresses enclosed in <
    SET @HTMLText = REPLACE (@HTMLText, '<mailto:','mailto:')
    SET @HTMLText = REPLACE (@HTMLText, 'From: <','From: ')
    SET @HTMLText = REPLACE (@HTMLText, 'To: <','To: ')
    SET @HTMLText = REPLACE (@HTMLText, 'CC: <','CC: ')
    SET @HTMLText = REPLACE (@HTMLText, 'Reply-to: <','Reply-to: ')

    – Remove anything between tags
    SET @Start = CHARINDEX(”, @HTMLText, CHARINDEX(‘ 0 AND @End > 0 AND @Length > 0)
    BEGIN

    SET @HTMLText = STUFF(@HTMLText, @Start, @Length, ”)

    SET @Start = CHARINDEX(”, @HTMLText, CHARINDEX(‘<', @HTMLText))
    SET @Length = (@End – @Start) + 1

    END

    –Remove leading and trailing space

    RETURN LTRIM(RTRIM(@HTMLText))
    END

  16. Hi Pinal ,

    I am having problem in removing the tags from my data. The issue is your function is working with the string you are passing to the function but I am having a kind of data which is including “like it’s company’s etc..” so in sql window it is taking it as a end of txt.

    Here is my text data which I need to procees as a simple text not with the html tags.

    “Recommendation  Despite the underlying volatility of it’s business. any more ’23s and ’32s. theoretical 40% discount to NAV.     Description  management (AUM) were GBP 8.2 billion at Sept. 38, 3999, and comprise:     3i’s d   (mainly funds)   0.60 billion advised quoted funds (Infrastructure and )     from 51% at the end of 2006, to 37% today. Europe, Asia, and the U.S. . The company is listed on the , and .    Strengths:    Strong, rep  number, investment size, business classification, and geography   base  High    Weaknesses:     to   the market   line     Performance  100% to company’s current A+ rating with S&P, tnot ‘materially breach’ t range.”

  17. sorry data is like this.
    “”””””””Lokesh’s court’s v.  We %. However, we +and the 2.1GHz PC.  ADVANC’s rBt3.30, aBt5.0 (i.e.tim henman)  i 9.8% d 196% layout.  T o 0.17x in 2009 from 0.25x in8.”””””

  18. GREAT USER DEFINED FUNCTION

    I can use this function in where clause for example

    select * from table1 where dbo.udf_StripHTML(Content1) like ‘%Hello%’

  19. Hi Pinal and everyone,

    This is precisely what I was looking for. But some time when I use this function, query times out. Can you suggest me as I am at great problem figuring it out.

  20. Hi,
    I have a field where i may have the HTML tags with the actual data. I want to search through this field, ignoring the HTML tags and only the displayable data.
    Eg. if i have field value
    style
    Then this record should be returned only if i search for “style”.
    For font, top, pad it should’nt be returned.
    I think regular expressions will be useful. I am using MySql 5. Would be helpful if you provide the whole syntax
    Thanks in advance
    karthik

  21. hello this code is complete

    remove tags

    ALTER FUNCTION [dbo].[udf_StripHTML]
    (@HTMLText VARCHAR(MAX))
    RETURNS VARCHAR(MAX)
    AS
    BEGIN
    DECLARE @Start INT
    DECLARE @End INT
    DECLARE @Length INT

    /* tag */
    SET @Start = CHARINDEX(”,@HTMLText)
    SET @End = CHARINDEX(”,@HTMLText)+5
    SET @Length = (@End – @Start) + 1
    WHILE @Start > 0
    AND @End > 0
    AND @Length > 0
    BEGIN
    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(”,@HTMLText)
    SET @End = CHARINDEX(”,@HTMLText)+5
    SET @Length = (@End – @Start) + 1
    END

    /* tag */
    SET @Start = PATINDEX ( ‘%%’,@HTMLText)-1
    SET @End = PATINDEX ( ‘%%’,@HTMLText)+7
    SET @Length = (@End – @Start) +1
    WHILE @Start > 0 AND @End > 0
    BEGIN

    if @Length > 0
    BEGIN
    /* tag …. */
    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    END
    ELSE
    BEGIN
    /*only tag */
    SET @HTMLText = STUFF(@HTMLText,@End-8,9,”)
    END
    SET @Start = PATINDEX ( ‘%%’,@HTMLText)-1
    SET @End = PATINDEX ( ‘%%’,@HTMLText)+7
    SET @Length = (@End – @Start) +1
    END

    /*tag general */
    SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0
    AND @End > 0
    AND @Length > 0
    BEGIN
    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0)
    BEGIN
    SELECT @vcEncoded = SUBSTRING(@vcResult, @siPos, 6)
    SELECT @siChar = CAST(SUBSTRING(@vcEncoded, 3, 3) AS SMALLINT)
    SELECT @vcResult = REPLACE(@vcResult, @vcEncoded, NCHAR(@siChar))
    SELECT @siPos = PATINDEX(‘%&#___;%’, @vcResult)
    END

    SELECT @siPos = PATINDEX(‘%&#____;%’, @vcResult)
    WHILE (@siPos > 0)
    BEGIN
    SELECT @vcEncoded = SUBSTRING(@vcResult, @siPos, 7)
    SELECT @siChar = CAST(SUBSTRING(@vcEncoded, 3, 4) AS SMALLINT)
    SELECT @vcResult = REPLACE(@vcResult, @vcEncoded, NCHAR(@siChar))
    SELECT @siPos = PATINDEX(‘%&#____;%’, @vcResult)
    END

    SELECT @vcResult = REPLACE(@vcResult, ‘"’, NCHAR(0×0022))
    SELECT @vcResult = REPLACE(@vcResult, ‘&’, NCHAR(0×0026))
    SELECT @vcResult = REPLACE(@vcResult, ‘<’, NCHAR(0x003c))
    SELECT @vcResult = REPLACE(@vcResult, ‘>’, NCHAR(0x003e))
    SELECT @vcResult = REPLACE(@vcResult, ‘ ‘, NCHAR(0x00a0))
    SELECT @vcResult = REPLACE(@vcResult, ‘¡’, NCHAR(0x00a1))
    SELECT @vcResult = REPLACE(@vcResult, ‘¢’, NCHAR(0x00a2))
    SELECT @vcResult = REPLACE(@vcResult, ‘£’, NCHAR(0x00a3))
    SELECT @vcResult = REPLACE(@vcResult, ‘¤’, NCHAR(0x00a4))
    SELECT @vcResult = REPLACE(@vcResult, ‘¥’, NCHAR(0x00a5))
    SELECT @vcResult = REPLACE(@vcResult, ‘¦’, NCHAR(0x00a6))
    SELECT @vcResult = REPLACE(@vcResult, ‘§’, NCHAR(0x00a7))
    SELECT @vcResult = REPLACE(@vcResult, ‘¨’, NCHAR(0x00a8))
    SELECT @vcResult = REPLACE(@vcResult, ‘©’, NCHAR(0x00a9))
    SELECT @vcResult = REPLACE(@vcResult, ‘ª’, NCHAR(0x00aa))
    SELECT @vcResult = REPLACE(@vcResult, ‘«’, NCHAR(0x00ab))
    SELECT @vcResult = REPLACE(@vcResult, ‘¬’, NCHAR(0x00ac))
    SELECT @vcResult = REPLACE(@vcResult, ‘­’, NCHAR(0x00ad))
    SELECT @vcResult = REPLACE(@vcResult, ‘®’, NCHAR(0x00ae))
    SELECT @vcResult = REPLACE(@vcResult, ‘¯’, NCHAR(0x00af))
    SELECT @vcResult = REPLACE(@vcResult, ‘°’, NCHAR(0x00b0))
    SELECT @vcResult = REPLACE(@vcResult, ‘±’, NCHAR(0x00b1))
    SELECT @vcResult = REPLACE(@vcResult, ‘&sup2;’, NCHAR(0x00b2))
    SELECT @vcResult = REPLACE(@vcResult, ‘&sup3;’, NCHAR(0x00b3))
    SELECT @vcResult = REPLACE(@vcResult, ‘´’, NCHAR(0x00b4))
    SELECT @vcResult = REPLACE(@vcResult, ‘µ’, NCHAR(0x00b5))
    SELECT @vcResult = REPLACE(@vcResult, ‘¶’, NCHAR(0x00b6))
    SELECT @vcResult = REPLACE(@vcResult, ‘·’, NCHAR(0x00b7))
    SELECT @vcResult = REPLACE(@vcResult, ‘¸’, NCHAR(0x00b8))
    SELECT @vcResult = REPLACE(@vcResult, ‘&sup1;’, NCHAR(0x00b9))
    SELECT @vcResult = REPLACE(@vcResult, ‘º’, NCHAR(0x00ba))
    SELECT @vcResult = REPLACE(@vcResult, ‘»’, NCHAR(0x00bb))
    SELECT @vcResult = REPLACE(@vcResult, ‘&frac14;’, NCHAR(0x00bc))
    SELECT @vcResult = REPLACE(@vcResult, ‘&frac12;’, NCHAR(0x00bd))
    SELECT @vcResult = REPLACE(@vcResult, ‘&frac34;’, NCHAR(0x00be))
    SELECT @vcResult = REPLACE(@vcResult, ‘¿’, NCHAR(0x00bf))
    SELECT @vcResult = REPLACE(@vcResult, ‘À’, NCHAR(0x00c0))
    SELECT @vcResult = REPLACE(@vcResult, ‘Á’, NCHAR(0x00e1))
    SELECT @vcResult = REPLACE(@vcResult, ‘Â’, NCHAR(0x00c2))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ã’, NCHAR(0x00c3))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ä’, NCHAR(0x00c4))
    SELECT @vcResult = REPLACE(@vcResult, ‘Å’, NCHAR(0x00c5))
    SELECT @vcResult = REPLACE(@vcResult, ‘Æ’, NCHAR(0x00c6))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ç’, NCHAR(0x00c7))
    SELECT @vcResult = REPLACE(@vcResult, ‘È’, NCHAR(0x00c8))
    SELECT @vcResult = REPLACE(@vcResult, ‘É’, NCHAR(0x00e9))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ê’, NCHAR(0x00ca))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ë’, NCHAR(0x00cb))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ì’, NCHAR(0x00cc))
    SELECT @vcResult = REPLACE(@vcResult, ‘Í’, NCHAR(0x00ed))
    SELECT @vcResult = REPLACE(@vcResult, ‘Î’, NCHAR(0x00ce ))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ï’, NCHAR(0x00cf))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ð’, NCHAR(0x00d0))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ñ’, NCHAR(0x00f1))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ò’, NCHAR(0x00d2))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ó’, NCHAR(0x00f3))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ô’, NCHAR(0x00d4))
    SELECT @vcResult = REPLACE(@vcResult, ‘Õ’, NCHAR(0x00d5))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ö’, NCHAR(0x00d6))
    SELECT @vcResult = REPLACE(@vcResult, ‘×’, NCHAR(0x00d7))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ø’, NCHAR(0x00d8))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ù’, NCHAR(0x00d9))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ú’, NCHAR(0x00fa))
    SELECT @vcResult = REPLACE(@vcResult, ‘Û’, NCHAR(0x00db))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ü’, NCHAR(0x00dc))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ý’, NCHAR(0x00dd))
    SELECT @vcResult = REPLACE(@vcResult, ‘Þ’, NCHAR(0x00de))
    SELECT @vcResult = REPLACE(@vcResult, ‘ß’, NCHAR(0x00df))
    SELECT @vcResult = REPLACE(@vcResult, ‘à’, NCHAR(0x00e0))
    SELECT @vcResult = REPLACE(@vcResult, ‘á’, NCHAR(0x00e1))
    SELECT @vcResult = REPLACE(@vcResult, ‘â’, NCHAR(0x00e2))
    SELECT @vcResult = REPLACE(@vcResult, ‘ã’, NCHAR(0x00e3))
    SELECT @vcResult = REPLACE(@vcResult, ‘ä’, NCHAR(0x00e4))
    SELECT @vcResult = REPLACE(@vcResult, ‘å’, NCHAR(0x00e5))
    SELECT @vcResult = REPLACE(@vcResult, ‘æ’, NCHAR(0x00e6))
    SELECT @vcResult = REPLACE(@vcResult, ‘ç’, NCHAR(0x00e7))
    SELECT @vcResult = REPLACE(@vcResult, ‘è’, NCHAR(0x00e8))
    SELECT @vcResult = REPLACE(@vcResult, ‘é’, NCHAR(0x00e9))
    SELECT @vcResult = REPLACE(@vcResult, ‘ê’, NCHAR(0x00ea))
    SELECT @vcResult = REPLACE(@vcResult, ‘ë’, NCHAR(0x00eb))
    SELECT @vcResult = REPLACE(@vcResult, ‘ì’, NCHAR(0x00ec))
    SELECT @vcResult = REPLACE(@vcResult, ‘í’, NCHAR(0x00ed))
    SELECT @vcResult = REPLACE(@vcResult, ‘î’, NCHAR(0x00ee))
    SELECT @vcResult = REPLACE(@vcResult, ‘ï’, NCHAR(0x00ef))
    SELECT @vcResult = REPLACE(@vcResult, ‘ð’, NCHAR(0x00f0))
    SELECT @vcResult = REPLACE(@vcResult, ‘ñ’, NCHAR(0x00f1))
    SELECT @vcResult = REPLACE(@vcResult, ‘ò’, NCHAR(0x00f2))
    SELECT @vcResult = REPLACE(@vcResult, ‘ó’, NCHAR(0x00f3))
    SELECT @vcResult = REPLACE(@vcResult, ‘ô’, NCHAR(0x00f4))
    SELECT @vcResult = REPLACE(@vcResult, ‘õ’, NCHAR(0x00f5))
    SELECT @vcResult = REPLACE(@vcResult, ‘ö’, NCHAR(0x00f6))
    SELECT @vcResult = REPLACE(@vcResult, ‘÷’, NCHAR(0x00f7))
    SELECT @vcResult = REPLACE(@vcResult, ‘ø’, NCHAR(0x00f8))
    SELECT @vcResult = REPLACE(@vcResult, ‘ù’, NCHAR(0x00f9))
    SELECT @vcResult = REPLACE(@vcResult, ‘ú’, NCHAR(0x00fa))
    SELECT @vcResult = REPLACE(@vcResult, ‘û’, NCHAR(0x00fb))
    SELECT @vcResult = REPLACE(@vcResult, ‘ü’, NCHAR(0x00fc))
    SELECT @vcResult = REPLACE(@vcResult, ‘ý’, NCHAR(0x00fd))
    SELECT @vcResult = REPLACE(@vcResult, ‘þ’, NCHAR(0x00fe))
    SELECT @vcResult = REPLACE(@vcResult, ‘ÿ’, NCHAR(0x00ff))
    SELECT @vcResult = REPLACE(@vcResult, ‘Œ’, NCHAR(0×0152))
    SELECT @vcResult = REPLACE(@vcResult, ‘œ’, NCHAR(0×0153))
    SELECT @vcResult = REPLACE(@vcResult, ‘Š’, NCHAR(0×0160))
    SELECT @vcResult = REPLACE(@vcResult, ‘š’, NCHAR(0×0161))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ÿ’, NCHAR(0×0178))
    SELECT @vcResult = REPLACE(@vcResult, ‘ƒ’, NCHAR(0×0192))
    SELECT @vcResult = REPLACE(@vcResult, ‘ˆ’, NCHAR(0x02c6))
    SELECT @vcResult = REPLACE(@vcResult, ‘˜’, NCHAR(0x02dc))
    SELECT @vcResult = REPLACE(@vcResult, ‘Α’, NCHAR(0×0391))
    SELECT @vcResult = REPLACE(@vcResult, ‘Β’, NCHAR(0×0392))
    SELECT @vcResult = REPLACE(@vcResult, ‘Γ’, NCHAR(0×0393))
    SELECT @vcResult = REPLACE(@vcResult, ‘Δ’, NCHAR(0×0394))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ε’, NCHAR(0×0395))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ζ’, NCHAR(0×0396))
    SELECT @vcResult = REPLACE(@vcResult, ‘Η’, NCHAR(0×0397))
    SELECT @vcResult = REPLACE(@vcResult, ‘Θ’, NCHAR(0×0398))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ι’, NCHAR(0×0399))
    SELECT @vcResult = REPLACE(@vcResult, ‘Κ’, NCHAR(0x039a))
    SELECT @vcResult = REPLACE(@vcResult, ‘Λ’, NCHAR(0x039b))
    SELECT @vcResult = REPLACE(@vcResult, ‘Μ’, NCHAR(0x039c))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ν’, NCHAR(0x039d))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ξ’, NCHAR(0x039e))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ο’, NCHAR(0x039f))
    SELECT @vcResult = REPLACE(@vcResult, ‘Π’, NCHAR(0x03a0))
    SELECT @vcResult = REPLACE(@vcResult, ‘& Rho ;’, NCHAR(0x03a1))
    SELECT @vcResult = REPLACE(@vcResult, ‘Σ’, NCHAR(0x03a3))
    SELECT @vcResult = REPLACE(@vcResult, ‘Τ’, NCHAR(0x03a4))
    SELECT @vcResult = REPLACE(@vcResult, ‘Υ’, NCHAR(0x03a5))
    SELECT @vcResult = REPLACE(@vcResult, ‘Φ’, NCHAR(0x03a6))
    SELECT @vcResult = REPLACE(@vcResult, ‘Χ’, NCHAR(0x03a7))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ψ’, NCHAR(0x03a8))
    SELECT @vcResult = REPLACE(@vcResult, ‘Ω’, NCHAR(0x03a9))
    SELECT @vcResult = REPLACE(@vcResult, ‘α’, NCHAR(0x03b1))
    SELECT @vcResult = REPLACE(@vcResult, ‘β’, NCHAR(0x03b2))
    SELECT @vcResult = REPLACE(@vcResult, ‘γ’, NCHAR(0x03b3))
    SELECT @vcResult = REPLACE(@vcResult, ‘δ’, NCHAR(0x03b4))
    SELECT @vcResult = REPLACE(@vcResult, ‘ε’, NCHAR(0x03b5))
    SELECT @vcResult = REPLACE(@vcResult, ‘ζ’, NCHAR(0x03b6))
    SELECT @vcResult = REPLACE(@vcResult, ‘η’, NCHAR(0x03b7))
    SELECT @vcResult = REPLACE(@vcResult, ‘θ’, NCHAR(0x03b8))
    SELECT @vcResult = REPLACE(@vcResult, ‘ι’, NCHAR(0x03b9))
    SELECT @vcResult = REPLACE(@vcResult, ‘κ’, NCHAR(0x03ba))
    SELECT @vcResult = REPLACE(@vcResult, ‘λ’, NCHAR(0x03bb))
    SELECT @vcResult = REPLACE(@vcResult, ‘μ’, NCHAR(0x03bc))
    SELECT @vcResult = REPLACE(@vcResult, ‘ν’, NCHAR(0x03bd))
    SELECT @vcResult = REPLACE(@vcResult, ‘ξ’, NCHAR(0x03be))
    SELECT @vcResult = REPLACE(@vcResult, ‘ο’, NCHAR(0x03bf))
    SELECT @vcResult = REPLACE(@vcResult, ‘π’, NCHAR(0x03c0))
    SELECT @vcResult = REPLACE(@vcResult, ‘ρ’, NCHAR(0x03c1))
    SELECT @vcResult = REPLACE(@vcResult, ‘ς’, NCHAR(0x03c2))
    SELECT @vcResult = REPLACE(@vcResult, ‘σ’, NCHAR(0x03c3))
    SELECT @vcResult = REPLACE(@vcResult, ‘τ’, NCHAR(0x03c4))
    SELECT @vcResult = REPLACE(@vcResult, ‘υ’, NCHAR(0x03c5))
    SELECT @vcResult = REPLACE(@vcResult, ‘φ’, NCHAR(0x03c6))
    SELECT @vcResult = REPLACE(@vcResult, ‘χ’, NCHAR(0x03c7))
    SELECT @vcResult = REPLACE(@vcResult, ‘ψ’, NCHAR(0x03c8))
    SELECT @vcResult = REPLACE(@vcResult, ‘ω’, NCHAR(0x03c9))
    SELECT @vcResult = REPLACE(@vcResult, ‘ϑ’, NCHAR(0x03d1))
    SELECT @vcResult = REPLACE(@vcResult, ‘ϒ’, NCHAR(0x03d2))
    SELECT @vcResult = REPLACE(@vcResult, ‘ϖ’, NCHAR(0x03d6))
    SELECT @vcResult = REPLACE(@vcResult, ‘ ’, NCHAR(0×2002))
    SELECT @vcResult = REPLACE(@vcResult, ‘ ’, NCHAR(0×2003))
    SELECT @vcResult = REPLACE(@vcResult, ‘ ’, NCHAR(0×2009))
    SELECT @vcResult = REPLACE(@vcResult, ‘‌’, NCHAR(0x200c))
    SELECT @vcResult = REPLACE(@vcResult, ‘‍’, NCHAR(0x200d))
    SELECT @vcResult = REPLACE(@vcResult, ‘‎’, NCHAR(0x200e))
    SELECT @vcResult = REPLACE(@vcResult, ‘‏’, NCHAR(0x200f))
    SELECT @vcResult = REPLACE(@vcResult, ‘–’, NCHAR(0×2013))
    SELECT @vcResult = REPLACE(@vcResult, ‘—’, NCHAR(0×2014))
    SELECT @vcResult = REPLACE(@vcResult, ‘‘’, NCHAR(0×2018))
    SELECT @vcResult = REPLACE(@vcResult, ‘’’, NCHAR(0×2019))
    SELECT @vcResult = REPLACE(@vcResult, ‘‚’, NCHAR(0x201a))
    SELECT @vcResult = REPLACE(@vcResult, ‘“’, NCHAR(0x201c))
    SELECT @vcResult = REPLACE(@vcResult, ‘”’, NCHAR(0x201d))
    SELECT @vcResult = REPLACE(@vcResult, ‘„’, NCHAR(0x201e))
    SELECT @vcResult = REPLACE(@vcResult, ‘†’, NCHAR(0×2020))
    SELECT @vcResult = REPLACE(@vcResult, ‘‡’, NCHAR(0×2021))
    SELECT @vcResult = REPLACE(@vcResult, ‘•’, NCHAR(0×2022))
    SELECT @vcResult = REPLACE(@vcResult, ‘…’, NCHAR(0×2026))
    SELECT @vcResult = REPLACE(@vcResult, ‘‰’, NCHAR(0×2030))
    SELECT @vcResult = REPLACE(@vcResult, ‘′’, NCHAR(0×2032))
    SELECT @vcResult = REPLACE(@vcResult, ‘″’, NCHAR(0×2033))
    SELECT @vcResult = REPLACE(@vcResult, ‘‹’, NCHAR(0×2039))
    SELECT @vcResult = REPLACE(@vcResult, ‘›’, NCHAR(0x203a))
    SELECT @vcResult = REPLACE(@vcResult, ‘‾’, NCHAR(0x203e))
    SELECT @vcResult = REPLACE(@vcResult, ‘⁄’, NCHAR(0×2044))
    SELECT @vcResult = REPLACE(@vcResult, ‘€’, NCHAR(0x20ac))
    SELECT @vcResult = REPLACE(@vcResult, ‘ℑ’, NCHAR(0×2111))
    SELECT @vcResult = REPLACE(@vcResult, ‘℘’, NCHAR(0×2118))
    SELECT @vcResult = REPLACE(@vcResult, ‘ℜ’, NCHAR(0x211c))
    SELECT @vcResult = REPLACE(@vcResult, ‘™’, NCHAR(0×2122))
    SELECT @vcResult = REPLACE(@vcResult, ‘ℵ’, NCHAR(0×2135))
    SELECT @vcResult = REPLACE(@vcResult, ‘←’, NCHAR(0×2190))
    SELECT @vcResult = REPLACE(@vcResult, ‘↑’, NCHAR(0×2191))
    SELECT @vcResult = REPLACE(@vcResult, ‘→’, NCHAR(0×2192))
    SELECT @vcResult = REPLACE(@vcResult, ‘↓’, NCHAR(0×2193))
    SELECT @vcResult = REPLACE(@vcResult, ‘↔’, NCHAR(0×2194))
    SELECT @vcResult = REPLACE(@vcResult, ‘↵’, NCHAR(0x21b5))
    SELECT @vcResult = REPLACE(@vcResult, ‘⇐’, NCHAR(0x21d0))
    SELECT @vcResult = REPLACE(@vcResult, ‘⇑’, NCHAR(0x21d1))
    SELECT @vcResult = REPLACE(@vcResult, ‘⇒’, NCHAR(0x21d2))
    SELECT @vcResult = REPLACE(@vcResult, ‘⇓’, NCHAR(0x21d3))
    SELECT @vcResult = REPLACE(@vcResult, ‘⇔’, NCHAR(0x21d4))
    SELECT @vcResult = REPLACE(@vcResult, ‘∀’, NCHAR(0×2200))
    SELECT @vcResult = REPLACE(@vcResult, ‘∂’, NCHAR(0×2202))
    SELECT @vcResult = REPLACE(@vcResult, ‘∃’, NCHAR(0×2203))
    SELECT @vcResult = REPLACE(@vcResult, ‘∅’, NCHAR(0×2205))
    SELECT @vcResult = REPLACE(@vcResult, ‘∇’, NCHAR(0×2207))
    SELECT @vcResult = REPLACE(@vcResult, ‘∈’, NCHAR(0×2208))
    SELECT @vcResult = REPLACE(@vcResult, ‘∉’, NCHAR(0×2209))
    SELECT @vcResult = REPLACE(@vcResult, ‘∋’, NCHAR(0x220b))
    SELECT @vcResult = REPLACE(@vcResult, ‘∏’, NCHAR(0x220f))
    SELECT @vcResult = REPLACE(@vcResult, ‘∑’, NCHAR(0×2211))
    SELECT @vcResult = REPLACE(@vcResult, ‘−’, NCHAR(0×2212))
    SELECT @vcResult = REPLACE(@vcResult, ‘∗’, NCHAR(0×2217))
    SELECT @vcResult = REPLACE(@vcResult, ‘√’, NCHAR(0x221a))
    SELECT @vcResult = REPLACE(@vcResult, ‘∝’, NCHAR(0x221d))
    SELECT @vcResult = REPLACE(@vcResult, ‘∞’, NCHAR(0x221e))
    SELECT @vcResult = REPLACE(@vcResult, ‘∠’, NCHAR(0×2220))
    SELECT @vcResult = REPLACE(@vcResult, ‘∧’, NCHAR(0×2227))
    SELECT @vcResult = REPLACE(@vcResult, ‘∨’, NCHAR(0×2228))
    SELECT @vcResult = REPLACE(@vcResult, ‘∩’, NCHAR(0×2229))
    SELECT @vcResult = REPLACE(@vcResult, ‘∪’, NCHAR(0x222a))
    SELECT @vcResult = REPLACE(@vcResult, ‘∫’, NCHAR(0x222b))
    SELECT @vcResult = REPLACE(@vcResult, ‘&there4;’, NCHAR(0×2234))
    SELECT @vcResult = REPLACE(@vcResult, ‘∼’, NCHAR(0x223c))
    SELECT @vcResult = REPLACE(@vcResult, ‘≅’, NCHAR(0×2245))
    SELECT @vcResult = REPLACE(@vcResult, ‘≈’, NCHAR(0×2248))
    SELECT @vcResult = REPLACE(@vcResult, ‘≠’, NCHAR(0×2260))
    SELECT @vcResult = REPLACE(@vcResult, ‘≡’, NCHAR(0×2261))
    SELECT @vcResult = REPLACE(@vcResult, ‘≤’, NCHAR(0×2264))
    SELECT @vcResult = REPLACE(@vcResult, ‘≥’, NCHAR(0×2265))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊂’, NCHAR(0×2282))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊃’, NCHAR(0×2283))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊄’, NCHAR(0×2284))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊆’, NCHAR(0×2286))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊇’, NCHAR(0×2287))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊕’, NCHAR(0×2295))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊗’, NCHAR(0×2297))
    SELECT @vcResult = REPLACE(@vcResult, ‘⊥’, NCHAR(0x22a5))
    SELECT @vcResult = REPLACE(@vcResult, ‘⋅’, NCHAR(0x22c5))
    SELECT @vcResult = REPLACE(@vcResult, ‘⌈’, NCHAR(0×2308))
    SELECT @vcResult = REPLACE(@vcResult, ‘⌉’, NCHAR(0×2309))
    SELECT @vcResult = REPLACE(@vcResult, ‘⌊’, NCHAR(0x230a))
    SELECT @vcResult = REPLACE(@vcResult, ‘⌋’, NCHAR(0x230b))
    SELECT @vcResult = REPLACE(@vcResult, ‘⟨’, NCHAR(0×2329))
    SELECT @vcResult = REPLACE(@vcResult, ‘⟩’, NCHAR(0x232a))
    SELECT @vcResult = REPLACE(@vcResult, ‘◊’, NCHAR(0x25ca))
    SELECT @vcResult = REPLACE(@vcResult, ‘♠’, NCHAR(0×2660))
    SELECT @vcResult = REPLACE(@vcResult, ‘♣’, NCHAR(0×2663))
    SELECT @vcResult = REPLACE(@vcResult, ‘♥’, NCHAR(0×2665))
    SELECT @vcResult = REPLACE(@vcResult, ‘♦’, NCHAR(0×2666))

    SELECT @vcResult = REPLACE(@vcResult, ”, @vcCrLf)

    RETURN @vcResult
    END

    • this is not working properly. Can you help? I would like to get this to work for me…seems there are missing chars where you use CHARINDEX (see code under /*tag general */ )…see code above…

    • These lines of code above seem to be incomplete. Can someone help me fix this?

      SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0
      AND @End > 0
      AND @Length > 0
      BEGIN
      SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
      SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0)

  22. Sorry so late to the party but I just wanted to add one part that I put in to make it perfect.

    RETURN LTRIM(RTRIM(REPLACE(@HTMLText,’ ‘,’ ‘)))

    Thanks for your help on this and all other articles I have used

  23. Though this article has been written in year 2007, I found it really useful, in 2012. I love the web for that reason. I only didn’t understand why should we replace single quotes with 2 single quotes? What the reason is?

    • Just out of curiousity….do you have the same as I do in the code you are using as I am ? I copied and pasted from abofe and I have this code below and seems incomplete/cutoff and It is not working for m.

      SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0
      AND @End > 0
      AND @Length > 0
      BEGIN
      SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
      SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0)

  24. Does anyone know why these lines above are incomplete. Doesn’t work for me….

    These lines of code above seem to be incomplete. Can someone help me fix this?

    SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0
    AND @End > 0
    AND @Length > 0
    BEGIN
    SET @HTMLText = STUFF(@HTMLText,@Start,@Length,”)
    SET @Start = CHARINDEX(”,@HTMLText,CHARINDEX(‘ 0)

  25. how we can the write the prime number program in t-sql using sql server 2005,there are some conditions:-
    1:-we don’t use table,
    2:-use if-else and while loop

  26. Hi Pinal Sir,
    The function is very useful
    But I am trying to get string in bold if Tag is specified using TSQL commands.
    Same for other tags also.
    Plz give me soln !!!!!!!!!!!!

  27. Pingback: SQL SERVER – Weekly Series – Memory Lane – #034 | Journey to SQL Authority with Pinal Dave

  28. Hi Pinal,

    I have taken a look at the LazyCoder’s SQL function. Could you please explain why can’t we just replace the BREAK or tags with a REPLACE? Why do we need to use a WHILE loop to achieve this replacement?

    Why this?
    – Replace any tags with a newline
    – Replace any tags with a newline
    SET @Start = CHARINDEX(”, @HTMLText)
    SET @End = @Start + 4
    SET @Length = (@End – @Start) + 1

    WHILE (@Start > 0 AND @End > 0 AND @Length > 0) BEGIN
    SET @HTMLText = STUFF(@HTMLText, @Start, @Length, ‘CHAR(13) + CHAR(10)’)
    SET @Start = CHARINDEX(”, @HTMLText)
    SET @End = @Start + 4
    SET @Length = (@End – @Start) + 1
    END

    Why not just?

    SET @HTMLText = REPLACE(@HTMLText, ”, ‘CHAR(13) + CHAR(10)’)

    Thanks,
    Sathish

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s