Sql 如何调用包含存储过程输入参数的.dtsx文件?
如何调用包含存储过程输入参数的.dtsx包文件 存储过程#1->将以逗号分隔的值在变量中传递要导出到excel的文件列表 输入变量将被传递到SSIS包以将数据导出到excel 如何处理包含存储过程调用输入参数的SSIS包?使用DtExec和xp\u cmdshell 一种方法是在sql server中使用xp_cmdshell实用程序从文件系统运行DtExec实用程序 首先,必须启用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
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)