我想在一个表中插入一个SSIS包中的几个变量。ssis - 将变量值插入表中
例如: -
@financialMonth, @Status, @Comments
变量已经被沿途基于查找,文件名,日期等值填充,我想将它们存储在一个结果表。
正在使用执行SQL任务的方式来做到这一点?
我是否需要调用sproc并将这些变量作为参数传递?
我试图把下面的T-SQL到的SQLStatement属性
INSERT INTO FilesProcessed
(ProcessedOn, ProviderCode, FinancialMonth,
FileName, Status, Comments)
SELECT GETDATE(), 'ABC' , 201006,
'ABC_201005_Testology.csv',
'Imported','Success'
我试图硬编码上述值来得到它的工作
这些都是在桌子上我的列米插入
Column_name Type Computed Length
fileID int no 4
ProcessedOn datetime no 8
ProviderCode nchar no 6
FinancialMonth int no 4
FileName nvarchar no 510
Status nvarchar no 40
Comments nvarchar no 510
这是表达代码馈送SQLStatementSource属性
"INSERT INTO FilesProcessed (ProcessedOn, ProviderCode, FinancialMonth,
FileName, Status, Comments) SELECT GETDATE() AS ProcessedOn, '"
+ @[User::providerCode] + "' , "
+ (DT_STR,6,1252)@[User::financialMonth] + ", '"
+ @[User::fileName] + "', 'Imported' AS Status,'Successfully' AS Comments "
不幸的是,我失去了一些东西,并不能完全得到它的工作。
The Error message I'm getting is ... Error: 0xC002F210 at Log entry in FilesProcessed, Execute SQL Task: Executing the query "INSERT INTO FilesProcessed (ProcessedOn, ProviderCode, FinancialMonth, FileName, Status, Comments) SELECT
GETDATE(), 'ABC' , 201006, 'DAG_201005_Testology.csv', 'Imported','Successfully'" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I2)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
请
一)。建议执行SQL任务是否是我想做的事情。 b)。给我任何指示或陷阱来寻找和检查。
在此先感谢。
这看起来应该从我记得关于SSIS的工作。 (尽管显然你发布的代码根本不使用变量)你得到了什么错误? – 2010-07-22 12:32:46
尝试删除“作为状态”和“作为评论” – 2010-07-22 13:32:04
我粘贴了用于创建T-SQL的表达式代码。我试图对T-SQL进行硬编码以查看更简单的代码是否工作。 – cometbill 2010-07-22 14:04:08