all groups > sql server dts > february 2007 >
You're in the

sql server dts

group:

Call DTS from Query Analyzer


Call DTS from Query Analyzer Rumpelstiltskin
2/26/2007 11:09:08 AM
sql server dts:
I'm trying to execute the following script from Query Analyzer. The
objective is to update the Global Variable in the DTS package. I'm not
getting any errors (@hr <> 0) yet the GV is not updating. I am a
sysadmin on the database.

DECLARE @hr int, @oPKG int, @name varchar(100)
SET @name = 'AL'

EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUT
EXEC @hr = sp_OAMethod @oPKG, 'LoadFromSQLServer',NULL, @@SERVERNAME,
@PackageName = 'WalkReport', @Flags = 256
EXEC @hr = sp_OASetProperty @oPKG,
'GlobalVariables("gv_Chapcode").Value', @name
EXEC @hr = sp_OAMethod @oPKG, 'Execute'
EXEC @hr = sp_OADestroy @oPKG

PS: Yes I've searched the groups but can't find out why mine would
fail.

Thanks,
Tim
Re: Call DTS from Query Analyzer Allan Mitchell
3/2/2007 4:51:47 AM

Have you had a read of this

Execute a package from T-SQL
(http://www.sqldts.com/210.aspx)

--


Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com



[quoted text, click to view]
AddThis Social Bookmark Button