-- Verify the email Function
Create Function isemail (@ value varchar (100) returns bit as begin declare @ object int declare @ V bit declare @ STR varchar (8000) -- Javascript Regular Expression definition and call statement set @ STR = 'var Reg =/^/W + [/+ /. /W-] * @ ([/W-] + /.) */W + [/W-] */. ([A-Z] {2, 3} |/d +) $/I; Reg. test ("'+ @ value +'") '-- call the script component to execute the script exec sp_oacreate 'msscriptcontrol. scriptcontrol ', @ object output exec sp_oasetproperty @ object, 'language', 'javascript 'exec sp_oamethod @ object, 'eval', @ v out, @ str -- destroy COM Object exec sp_oadestroy @ object return @ v end -- Test statement select * from (select 'aa .bb.com 'as email Union
Select 'junkaih @ 163.com ') as t where DBO. isemail (email) = 1 -- enable OLE Automation procedures -- exec sp_configure 'show advanced options', 1 -- reconfigure -- exec sp_configure 'ole automation procedures 'If sql2005 prompts no permission ', 1 -- reconfigure