• You can handle all the nested comments by using the following code:

    DECLARE

    @comment VARCHAR(100),

    @endPosition INT,

    @startPosition INT,

    @commentLen INT,

    @substrlen INT,

    @len INT

    WHILE (CHARINDEX('/*',@def)<>0)

    BEGIN

    SET @endPosition = charindex('*/',@def)

    SET @substrlen=len(substring(@def,1,@endPosition-1))

    SET @startPosition = @substrlen - charINDEX('*/',reverse(substring(@def,1,@endPosition-1)))+1

    SET @commentLen = @endPosition - @startPosition

    SET @comment = substring(@def,@startPosition-1,@commentLen+3 )

    SET @def = REPLACE(@def,@comment,CHAR(13))

    END

    Kindest Regards,
    Shivaram Challa
    (http://challa.net - Home of the "Excel to CSV converter & Browsepad applications".)
    Forum Etiquette: How to post data/code on a forum to get the best help[/url]