SqlServer扩展存储过程

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
View Code

 2.利用Package(.dtsx)加载数据文件到DB中:

master..xp_cmdshell 
'F:FCapSSISPkgScriptsWorkingDTSBinndtexec /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""'
View Code
原文地址:https://www.cnblogs.com/sccd/p/5535746.html