Re: Creating Job with ActiveX script

From: Barry McAuslin (barry_mcauslin_at_yahoo.com.nospam)
Date: 12/02/04


Date: Thu, 2 Dec 2004 17:48:57 +1300

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.


Relevant Pages

  • Re: ActiveX script works in DTS but not in job, why?
    ... Peter DeBetta, MVP - SQL Server ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... 2000 databases including DTS packages. ...
    (microsoft.public.sqlserver.dts)
  • Re: Maintain production DB with changes from development DB
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... Or will I have to write a script to update all 4 servers? ...
    (microsoft.public.sqlserver.dts)
  • Re: Vista hosting XPe tools/db
    ... Are you running this script on the machine that actually has the SQL server ... machine hosting the database. ... i don't know if you can install a second instance of SQL ...
    (microsoft.public.windowsxp.embedded)
  • Re: ActiveX script works in DTS but not in job, why?
    ... Account that SQL Agent runs under and it is a Local Admin on the box. ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... that would be since I need to be able to load DTS packages from either a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)