Friday, February 24, 2012

Creating Job with ActiveX script

Hi,
Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
file.
However, I wanted to schedule the process so I created a job that runs this
script with the step as an ActiveX script step.
However, I get the error: Error 14277 Command script does not destroy all
objects it creates.
I checked the code and I only create two SQL-DMO objects of which I both set
to 'Nothing' at the end.
Have checked MS Knowledge Base and Internet but find nothing on it, other
that use DTS instead. I can do that but wondered why this error should occur.
Using SQL Server 7.0, SP3. Thanks.
These objects do not need to be created explicitly with CreateObject. Any
variable assigned with Set is an object and will need to be set to Nothing.
ie
Set sql = CreateObject("SQLOLEDB.Connection")
...
Set rs = sq.Execute("SELECT name from master.dbo.sysdatabases")
Set rs = Nothing
Set sql = Nothing
Regards
Barry McAuslin
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"PRW" <PRW@.discussions.microsoft.com> wrote in message
news:BF401CF0-746F-43C4-B551-6DE1A8C6042D@.microsoft.com...
> Hi,
> Have created a VBscript that run SQL-DMO that runs successfully as a .vbs
> file.
> However, I wanted to schedule the process so I created a job that runs
this
> script with the step as an ActiveX script step.
> However, I get the error: Error 14277 Command script does not destroy all
> objects it creates.
> I checked the code and I only create two SQL-DMO objects of which I both
set
> to 'Nothing' at the end.
> Have checked MS Knowledge Base and Internet but find nothing on it, other
> that use DTS instead. I can do that but wondered why this error should
occur.
> Using SQL Server 7.0, SP3. Thanks.

No comments:

Post a Comment