I just started my first .NET/SQL Server job today and I was given an assignment. I have to take the data in a VARCHAR(max) field, strip out the HTML tags in it and rebuild the text with a beginning and ending paragraph HTML tag (<p>, </p>) and make the first sentence in the text in bold (<b>, </b>). I know the HTML tags and the field, the table and the database name. My supervisor wants me to do this in a stored procedure and I'm not sure of what commands I can use to do this. Any help would be appreciated.


Re: Stored Procedures in SQL Server

Arnie Rowland

This is a good example of where creating a VB/C# CLR Function using RegEx would be very helpful. (Assuming you are using SQL 2005.)

With .NET and RegEx, this will be 'simple'.

Using T-SQL, it will be a PITA.

Re: Stored Procedures in SQL Server

Joe Webb

As Arnie mentioned, this is a good opportunity to use the CLR integration capabilities in SQL Server.

Here are a couple of links to help get you started. Google for others, they are a-plenty.