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\""'
本文介绍如何在SQL Server中启用和使用扩展存储过程xp_cmdshell执行系统命令,并展示了通过xp_cmdshell调用SSIS包来加载数据文件的具体步骤。
1974

被折叠的 条评论
为什么被折叠?



