SELECT pk, lastname, dbo.STREXTRACT(subsinfo, '<offer>', '</offer>') AS offer FROM subscriptions WHERE ...Works just fine for me. Also note that there MAY be something built into T-SQL to handle this, but I sure couldn't find it and just rolled my own in a few minutes. You can drill into XML somehow in T-SQL with a DOM object, but it may not be any more efficient than this:
CREATE FUNCTION [dbo].[STREXTRACT] ( @cSearchExpression AS varchar(8000), @cBeginDelim AS varchar(30), @cEndDelim AS varchar(30) ) RETURNS varchar(100) AS BEGIN DECLARE @nStart1 AS int DECLARE @nLength1 AS int DECLARE @nStart2 As int DECLARE @nValueStart As int DECLARE @nValueLength As int DECLARE @cResult As varchar(30) SET @cResult = '' SET @nStart1 = charindex(@cBeginDelim, @cSearchExpression) SET @nLength1 = LEN(@cBeginDelim) SET @nStart2 = charindex(@cEndDelim, @cSearchExpression) IF @nStart1 > 0 BEGIN SET @nValueStart = @nStart1 + @nLength1 IF @nStart2 >= @nValueStart BEGIN SET @nValueLength = @nStart2 - @nValueStart SET @cResult = SUBSTRING(@cSearchExpression, @nValueStart, @nValueLength) END END RETURN @cResult END GO