if exists (select * from dbo.sysobjects where id = object_id(N[dbo].[s_LoadPackageToServer]) and OBJECTPROPERTY(id, NIsProcedure) = 1) Create procedure s_LoadPackageToServer exec @rc = sp_OACreate DTS.Package, @objPackage output exec @rc = sp_OAMethod @objPackage, LoadFromStorageFile , null,
drop procedure [dbo].[s_LoadPackageToServer]
GO
@PackageName varchar(128) ,
@FileName varchar(500) ,
@Username varchar(100) ,
@Password varchar(100)
as
/*
exec s_LoadPackageToServer
@PackageName = mypackage ,
@FileName = c:\dtspckgs\mypackage.dts ,
@Username = sa ,
@Password = pwd
*/
declare @objPackage int
declare @rc int
if @rc <> 0
begin
raiserror(failed to create package rc = %d, 16, -1, @rc)
return
end
@UncFile = @FileName, @password = null
if @rc <> 0
begin
raiserror(failed to load package rc = %d, package = %s, 16, -1, @rc, @PackageName)
return
end
exec @rc = sp_OAMethod @objPackage, SaveToSQLServerAs , null,
@NewName = @PackageName, @ServerName = @@ServerName, @ServerUserName = @Username, @ServerPassword = @Password
if @rc <> 0
begin
raiserror(failed to load package rc = %d, package = %s, 16, -1, @rc, @PackageName)
return
end
go
exec s_LoadPackageToServer
mypackage ,
c:\DTS_AN2CP_DIC.dts ,
sa ,
sa
[sqlserver][dts][存储过程]将dts包文件加载到服务器上_数据库技巧
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » [sqlserver][dts][存储过程]将dts包文件加载到服务器上_数据库技巧
相关推荐
-      sql语句中的判断功能的使用方法
-      sql语句中的判断功能的使用方法
-      SQL语言中去掉小数点有效数字后面的所有0
-      ASP连接各种数据库的代码
-      在sql语句中实现md5功能
-      给access数据库减肥
-      asp连接access数据库代码(2)
-      更改 SQL Server 登录模式