Sqlserver calls Javascript

Source: Internet
Author: User
-- 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.