DECLARE @object int
DECLARE @hr bigint
if len(@msg)=0
begin
EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
if @hr <> 0
BEGIN
set @msg=@msg + convert(varchar(30),@hr) + ': Error creating object DTS.Package # '
END
end
if len(@msg)=0
begin
SET @Cmd = 'LoadFromSQLServer("' + @Server +'", "' + @UserName + '", "' + @Password + '", 0, "", , , "' + @PkgName + '")'
EXEC @hr = sp_OAMethod @object, @Cmd, NULL
IF @hr <> 0
BEGIN
set @msg=@msg +convert(varchar(30),@hr) + ': Error loading LoadFromSQLServer # '
END
end
select @msg as Message
|