Friday, February 17, 2012

DTS import not working

Hello, I have created a dts structured storage file that I want to execute with a stored procedure. The dts runs fine while in enterprise manager, but when I call the file from the stored procedure below I get this error: error LoadFromStorageFile
anybody have some ideas on what's going on?
Here is the SPROC:
DECLARE @.object int
DECLARE @.hr int

--create a package object
EXEC @.hr = sp_OACreate 'DTS.Package', @.object OUTPUT
if @.hr <> 0
BEGIN
print 'error create DTS.Package'
RETURN
END

EXEC @.hr = sp_OAMethod @.object, 'LoadFromStorageFile',
NULL, 'C:\importData.dts', ''
IF @.hr <> 0
BEGIN
print 'error LoadFromStorageFile'
RETURN
END

EXEC @.hr = sp_OAMethod @.object, 'Execute'
IF @.hr <> 0
BEGIN
print 'Execute failed'
RETURN
END
GO

I'm not sure why it is failing but why not make it a scheduled job in Enterprise Manager?

No comments:

Post a Comment