1. 扩展存储过程xp_cmdshell用法:
--1.启用
SP_CONFIGURE 'show advanced options',1
RECONFIGURE
GO
SP_CONFIGURE 'xp_cmdshell',1
RECONFIGURE
GO
--2.用法
master..xp_cmdshell 'DIR D:\'
--3.关闭
SP_CONFIGURE 'xp_cmdshell', 0
RECONFIGURE
GO
SP_CONFIGURE 'show advanced options', 0
RECONFIGURE
GO
2.利用Package(.dtsx)加载数据文件到DB中:
master..xp_cmdshell
'F:\FCapSSISPkg\Scripts\Working\DTS\Binn\dtexec /FILE
Package文件路径\PackageName.dtsx /DECRYPT XXXXXX
/set \Package.Variables[Server].Value;"\".\""
/set \Package.Variables[ServerFIS].Value;"\".\""
/set \Package.Variables[BaseFolder].Value;"\"E:\要加载的文件的路径\""
/set \Package.Variables[参数名].Value;"\"参数值1\""
/set \Package.Variables[参数名].Value;"\"参数值1\""'