As do I IF OBJECT_Id('dbo.fn_regex') IS NOT NULL DROP FUNCTION dbo.fn_regexGOCREATE FUNCTION dbo.fn_regex( @pattern VARCHAR(255) , @matchstring TEXT ) RETURNS INTAS BEGIN DECLARE @obj INT SET @obj = -1 DECLARE @res INT SET @res = -1 DECLARE @match BIT SET @match = 0 -- Make the @res Object. EXEC @res = sp_OACreate 'VBScript.RegExp', @obj OUT IF (@res <> 0) RETURN -1 -- Assign the Pattern to it. EXEC @res = sp_OASetProperty @obj, 'Pattern', @pattern IF (@res <> 0) RETURN -2 -- Set to ignore Case EXEC @res = sp_OASetProperty @obj, 'IgnoreCase', 1 IF (@res <> 0) RETURN -3 -- Execute the regular expression EXEC @res = sp_OAMethod @obj, 'Test',@match OUT, @matchstring IF (@res <> 0) RETURN -4 -- Cleanup the object EXEC @res = sp_OADestroy @obj -- Return the results RETURN @matchENDGOSELECT * FROM table_name WHERE dbo.fn_regex('dog', table_name.column_name) = 1
-------------Charlie