SSIS任务中的范围标识错误(Scope Identity error in SSIS Task)

编程入门 行业动态 更新时间:2024-10-11 17:20:24
SSIS任务中的范围标识错误(Scope Identity error in SSIS Task) CREATE TABLE SSIS_AuditResults( AuditID INT IDENTITY(1,1), PackageName varchar(35), ExecutionTime datetime, Filename_Path varchar(100), RecordCount integer, EndTime datetime, PackageStatus varchar(10) )

上面是我的表。 我使用下面的查询来执行SQL TASK

INSERT INTO SSIS_AuditResults(PackageName,ExecutionTime) SELECT ? ,? select scope_identity()

在参数I中映射packagename和executuion时间。 在结果映射中,我正在创建一个名为的新变量

Identity_Generator data type int 64,value 0

执行我的包后,我收到以下错误

[执行SQL任务]错误:为变量“Identity_Generator”赋值时发生错误:“分配给变量的值的类型”User :: Identity_Generator“与当前变量类型不同。变量在执行期间可能不会更改类型。变量类型是严格的,除了Object类型的变量。

我正在给INT,但它给我一个错误。 有人可以在我犯错的地方帮助我吗?

CREATE TABLE SSIS_AuditResults( AuditID INT IDENTITY(1,1), PackageName varchar(35), ExecutionTime datetime, Filename_Path varchar(100), RecordCount integer, EndTime datetime, PackageStatus varchar(10) )

Above is my Table. I am using the query below to execute SQL TASK

INSERT INTO SSIS_AuditResults(PackageName,ExecutionTime) SELECT ? ,? select scope_identity()

In parameter I am mapping packagename and executuion time. In result mapping I am creating a new variable with name

Identity_Generator data type int 64,value 0

After executing my package i am getting the error below

[Execute SQL Task] Error: An error occurred while assigning a value to variable "Identity_Generator": "The type of the value being assigned to variable "User::Identity_Generator" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

I am giving INT but it is showing me an error. Can someone help me where I am making a mistake?

最满意答案

SSIS中的数据类型不允许更改,除非它是Object类型。 您的表将AuditID定义为int。 SQL Server int数据类型与SSIS中的Int32数据类型相关联。

您的包将Identity_Generator SSIS变量定义为Int64类型,类似于SQL Server数据类型中的bigint。

要解决此问题,您需要使类型对齐:将SQL Server类型更改为bigint或将Variable更改为Int32。 正确的方法取决于您的环境的具体情况。

Data types in SSIS are not allowed to change, unless it's an Object type. Your table defined AuditID as int. A SQL Server int data type correlates to the Int32 data type in SSIS.

Your package defined the Identity_Generator SSIS Variable as type Int64 which is analogous to bigint in SQL Server data types.

To resolve this, you will need to make your types align: either change your SQL Server types to bigint or change your Variable to Int32. The correct approach will depend upon the specifics of your environment.

更多推荐

本文发布于:2023-08-05 17:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1437179.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识   错误   SSIS   Scope   Task

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!