将数据从 .csv 文件导入表格时,在 SSIS 中制定规则 [英] making rules in SSIS while importing data to tables from a .csv files

查看:29
本文介绍了将数据从 .csv 文件导入表格时,在 SSIS 中制定规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从包含用户记录的 csv 文件中导入数据.我在这里面临的问题是验证所有必填字段是否存在.我需要检查所有行是否包含用户名(或其他一些值....).我如何为这个问题制定规则.我是 SSIS 的新手.任何帮助表示赞赏.提前致谢.

i have to import data from a csv file which contains records of users. the problem i face here is to verify that all required field is present. I need to check that all the lines contains the USER NAME(or some other values....).how do i make rule for this problem. m a newbie in SSIS. any help is appreciated. thanks in advance.

推荐答案

条件拆分可以满足您的需求.只需将错误记录的条件写入任何必填字段中的空白即可(即,如果名称和密码以及部门都是必需的,则条件:

A Conditional split will do what you need here. Just write your condition for error records to have blanks in any of your requried fields (i.e. if name and password and dept are all required, then the condition:

isnull(name) ||(len(trim(name))==0) ||isnull(密码) ||(len(trim(password))==0) ||isnull(dept) ||(len(trim(dept))==0)

isnull(name) || (len(trim(name))==0) || isnull(password) || (len(trim(password))==0) || isnull(dept) || (len(trim(dept))==0)

将是错误行的条件(如果您使用条件中出现的默认值,则此条件将是案例 1).

would be the condition (if you use the defaults that come up in a conditional then this condition would be Case 1) for the Error rows.

在您的流程中,将案例 1 的箭头指向您的 ERROR_USERS 表写入过程,并将条件拆分默认输出的箭头指向您的 USERS 表.

In your flow, direct the arrow for Case 1 to your ERROR_USERS table write process, and the arrow for Conditional Split Default Output to your USERS Table.

这篇关于将数据从 .csv 文件导入表格时,在 SSIS 中制定规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆