Ken Henderson's WebLog
USE GenAppGO--UNCOMMENT AND RUN THOSE FIRST
-- --ENABLE Ole Automation Procedures --EXECUTE sp_configure 'Ole Automation Procedures', '1'
--RECONFIGURE WITH OVERRIDE
-- --SHOW THE CONFIGURATION --EXEC SP_CONFIGURE; CREATE FUNCTION
dbo.fn_regex(@pattern varchar(255), @matchstring varchar(8000))
RETURNS int
ASBEGINdeclare @obj int
declare @res int
declare @match bit
set @match=0
exec @res=sp_OACreate 'VBScript.RegExp',@obj OUT
IF (@res <> 0) BEGIN
RETURN NULL
ENDexec @res=sp_OASetProperty @obj, 'Pattern', @pattern
IF (@res <> 0) BEGIN
RETURN NULL
ENDexec @res=sp_OASetProperty @obj, 'IgnoreCase', 1
IF (@res <> 0) BEGIN
RETURN NULL
ENDexec @res=sp_OAMethod @obj, 'Test',@match OUT, @matchstring
IF (@res <> 0) BEGIN
RETURN NULL
ENDexec @res=sp_OADestroy @objreturn @match
ENDGO
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!