Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何调用包含存储过程输入参数的.dtsx文件?_Sql_Sql Server_Stored Procedures_Ssis_Etl - Fatal编程技术网

Sql 如何调用包含存储过程输入参数的.dtsx文件?

Sql 如何调用包含存储过程输入参数的.dtsx文件?,sql,sql-server,stored-procedures,ssis,etl,Sql,Sql Server,Stored Procedures,Ssis,Etl,如何调用包含存储过程输入参数的.dtsx包文件 存储过程#1->将以逗号分隔的值在变量中传递要导出到excel的文件列表 输入变量将被传递到SSIS包以将数据导出到excel 如何处理包含存储过程调用输入参数的SSIS包?使用DtExec和xp\u cmdshell 一种方法是在sql server中使用xp_cmdshell实用程序从文件系统运行DtExec实用程序 首先,必须启用xp\u cmdshell实用程序: -- To allow advanced options to be cha

如何调用包含存储过程输入参数的.dtsx包文件

存储过程#1->将以逗号分隔的值在变量中传递要导出到excel的文件列表

输入变量将被传递到SSIS包以将数据导出到excel

如何处理包含存储过程调用输入参数的SSIS包?

使用DtExec和xp\u cmdshell 一种方法是在sql server中使用xp_cmdshell实用程序从文件系统运行DtExec实用程序

首先,必须启用
xp\u cmdshell
实用程序:

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
-- WITH OVERRIDE disables the configuration value checking if the value is valid
RECONFIGURE WITH OVERRIDE
GO
-- To enable the xp_cmdshell component.
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE WITH OVERRIDE 
GO
-- Revert back the advance option
EXEC sp_configure 'show advanced options', 0
GO 
RECONFIGURE WITH OVERRIDE 
GO
然后,您可以使用以下命令执行包并将变量值作为参数传递:

DECLARE @SQLQuery AS VARCHAR(2000)

DECLARE @ServerName VARCHAR(200) = 'ARSHAD-LAPPY' 

SET @SQLQuery = 'DTExec /FILE ^"E:\DataTransfer.dtsx^" '
SET @SQLQuery = @SQLQuery + ' /SET \Package.Variables[ServerName].Value;^"'+ @ServerName + '^"'

EXEC master..xp_cmdshell @SQLQuery
GO

工具书类
有用的链接
  • (如果使用SSIDB)
  • (如果使用SSIDB)

我认为你有一个惊人的工作答案,为什么不接受它呢???@goofyui问题解决了吗?