如何在 SSIS 导入中插入相同的 guid [英] How to insert the same guid in SSIS import

查看:36
本文介绍了如何在 SSIS 导入中插入相同的 guid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ssis 包将数据从 csv 平面文件插入到 sql 表中.我在名为 GUID 的目标表中添加了一个新列.每次包运行时,我都需要为所有行插入相同的 guid.问题是它为每一行生成新的 guid.

I am inserting data from csv flat file to sql table using ssis package. I added a new column to the destination table called GUID. I need to insert the same guid for all rows every time the package runs. The problem is that it generates new guid for every row.

推荐答案

你需要在包中多出一个步骤来生成 RunID(执行 SQL 并将结果放入一个变量中),然后,当你插入数据时(不管你在做什么),将 RunID 变量作为参数传递到查询中,该参数被选为 GUID 列的值.

You need an extra step in the package to generate the RunID (execute SQL and get the result into a variable), then, when you're inserting data (however you're doing it), pass the RunID variable into the query as a parameter that is selected as the value for the GUID column.

这篇关于如何在 SSIS 导入中插入相同的 guid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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