Results 1 to 2 of 2

Thread: vbs script runs as standalone, but not in dts or sql job

  1. #1
    Neil Guest

    vbs script runs as standalone, but not in dts or sql job

    I have a vbs script to try to prove that I can perform vbs scripting in either a job step or a dts package
    The script is

    dim rs, sql,adoconn, adocommand, dataconnstring

    set adoconn = createObject("ADODB.CONNECTION&#34
    Set rs = CreateObject("ADODB.Recordset&#34
    set adocommand = CreateObject("ADODB.Command&#34
    adoconn.ConnectionString = "Provider=SQLOLEDB;Server=myserver;Database=pu bs;Uid=myuser;Pwd=mypass;"

    adoconn.Open
    sql = "select * from import"
    rs.Open sql, adoconn,adOpenForwardOnly
    while rs.EOF = false
    sql = "insert into zz default values"
    adocommand.ActiveConnection = adoconn
    adocommand.CommandText = sql
    adocommand.Execute

    rs.MoveNext
    wend

    rs.Close
    adoconn.Close
    set adoconn = nothing


    However,
    when I run this from windows explorer it works fine,
    but when I try to run it as an activeX script, I get the error ActiveX scripting: Function not found

    As a cmdexec step in a job, I use the line c:inetpubwwwrootvbsvbstest1.vbs
    It failed with the error
    The process could not be created for step 1 of job 0x119BDBD264AD9B4597A9302786F0E250 (reason: %1 is not a valid Win32 application). The step failed.


    What is wrong with the vbs script ?, or do I need to invoke it a different way ?

    thanks in advance

  2. #2
    Guest

    vbs script runs as standalone, but not in dts or sql job (reply)

    Neil, when you run it from Windows Explorer are you
    a)running it directly from the SQL Server machine and
    b)using the same NT account that SQL Server Agent runs in.

    I suspect the most likely cause of the error is to do with the machine that SQL Server is set up on.


    ------------
    Neil at 6/19/01 6:45:38 AM

    I have a vbs script to try to prove that I can perform vbs scripting in either a job step or a dts package
    The script is

    dim rs, sql,adoconn, adocommand, dataconnstring

    set adoconn = createObject("ADODB.CONNECTION&#34
    Set rs = CreateObject("ADODB.Recordset&#34
    set adocommand = CreateObject("ADODB.Command&#34
    adoconn.ConnectionString = "Provider=SQLOLEDB;Server=myserver;Database=pu bs;Uid=myuser;Pwd=mypass;"

    adoconn.Open
    sql = "select * from import"
    rs.Open sql, adoconn,adOpenForwardOnly
    while rs.EOF = false
    sql = "insert into zz default values"
    adocommand.ActiveConnection = adoconn
    adocommand.CommandText = sql
    adocommand.Execute

    rs.MoveNext
    wend

    rs.Close
    adoconn.Close
    set adoconn = nothing


    However,
    when I run this from windows explorer it works fine,
    but when I try to run it as an activeX script, I get the error ActiveX scripting: Function not found

    As a cmdexec step in a job, I use the line c:inetpubwwwrootvbsvbstest1.vbs
    It failed with the error
    The process could not be created for step 1 of job 0x119BDBD264AD9B4597A9302786F0E250 (reason: %1 is not a valid Win32 application). The step failed.


    What is wrong with the vbs script ?, or do I need to invoke it a different way ?

    thanks in advance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •