How to test the created function via the SQL Server editor - 6.2

Talend MDM Platform Studio User Guide

EnrichVersion
6.2
EnrichProdName
Talend MDM Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio
  • To test the created function via the SQL server editor, copy the below code and execute it:

    create table Contacts (
    FirstName nvarchar(30),
     LastName nvarchar(30),
    EmailAddress nvarchar(30) CHECK
     (dbo.RegExMatch('[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)
     +(com|org|edu|nz)',
    EmailAddress)=1),
    USPhoneNo nvarchar(30) CHECK
     (dbo.RegExMatch('\([1-9][0-9][0-9]\) [0-9][0-9][0-9]
    \-[0-9][0-9][0-9][0-9]',
    UsPhoneNo)=1))
    
    INSERT INTO [talend].[dbo].[Contacts]
                            ([FirstName]
                           , [LastName]
                           , [EmailAddress]
                           , [USPhoneNo])
           VALUES
                         ('Hallam'
                        , 'Amine'
                        , 'mhallam@talend.com'
                        , '0129-2090-1092')
                        , ( 'encoremoi'
                         , 'nimportequoi'
                         , 'amine@zichji.org'
                         , '(122) 190-9090')
    GO

  • To search for the expression that match, use the following code:

    SELECT [FirstName]
         , [LastName]
         , [EmailAddress]
         , [USPhoneNo]
      FROM [talend].[dbo].[Contacts]
      where [talend].[dbo].RegExMatch([EmailAddress],
    '[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)+(com|org|edu|nz|au)')
    = 1 
    
    

  • To search for the expression that do not match, use the following code:

    SELECT [FirstName]
         , [LastName]
         , [EmailAddress]
         , [USPhoneNo]
      FROM [talend].[dbo].[Contacts]
      where [talend].[dbo].RegExMatch([EmailAddress],
    '[a-zA-Z0-9_\-]+@([a-zA-Z0-9_\-]+\.)+(com|org|edu|nz|au)')
    = 0