简体   繁体   English

如何在 SSIS 中的 Conditional Split 中使用 like condition

[英]How to use like condition in Conditional Split in SSIS

I am using conditional split to filter out the data from table.我正在使用条件拆分来过滤表中的数据。 I have couple of conditions to check for.我有几个条件要检查。 For example, In Email column, value should not contain ~ character and contain @ sign.例如,在 Email 列中,值不应包含 ~ 字符并包含 @ 符号。 Date of birth column, year should not be greater than current year, month should not be greater that 12 and day should not be greater than 31.出生日期列,年不得大于当年,月不得大于 12,日不得大于 31。

SELECT *
FROM [table]
WHERE Email LIKE '%~%'
   OR NOT (Email LIKE "%@%")
   OR SUBSTRING(CONVERT(varchar, DOb, 23), 1, 2) <= 12
   OR SUBSTRING(CONVERT(varchar, DOb, 23), 4, 2) <= 31
   OR SUBSTRING(CONVERT(varchar, DOb, 23), 7, 4) <= YEAR(GETDATE());

I have above sql query for the same.我上面有 sql 查询。 But not sure how to implement it in SSIS using conditional split.但不确定如何使用条件拆分在 SSIS 中实现它。

Add additional columns in your source query depending on your conditions and then use those columns in conditional split.根据您的条件在源查询中添加其他列,然后在条件拆分中使用这些列。

    SELECT CASE 
            WHEN Email LIKE '%@%'
                OR Email LIKE '%~%'
                THEN 'bad data'
            ELSE 'good data'
            END AS emaildatatype
        ,*
    FROM [table]
WHERE Email LIKE '%~%'
        OR NOT (Email LIKE "%@%")
        OR SUBSTRING(CONVERT(VARCHAR, DOb, 23), 1, 2) <= 12
        OR SUBSTRING(CONVERT(VARCHAR, DOb, 23), 4, 2) <= 31
        OR SUBSTRING(CONVERT(VARCHAR, DOb, 23), 7, 4) <= YEAR(GETDATE());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM