Sign in to follow this  
Followers 0
m0ng0l.h0rde

Script doesn't execute under Windows Server 2003

3 posts in this topic

Hi,

I am in the process of writing a script to run a large number (~20) of sql query files against a database. When I run the script (for testing) on a WinXP system, it works flawlessly.

However, when I try to run the compiled script on a Windows 2003 Server, with SQL Server 2005, the script does not execute. It should initially come up and ask for the SA password, and the server name, these do not come up. I get no errors, nor do I have the taskbar inidicator that AutoIT is running.

I am using AutoIT v3.2.0.1.

The code is below (rather compact, I feel)

#include <array.au3>
Dim $arrquery[1]

$sqlSApwd = InputBox("SA Password required", "What is the SA password for the server?", "", "*M")
$sqlServerName = InputBox("SQL Servername required", "What is the SQL Server name?")

$sqlquery = FileFindFirstFile ("*.sql")
$x = 1

While 1
    $arrquery[$x-1] = FileFindNextFile($sqlquery)
    if @error then ExitLoop
    $x=$x+1
    ReDim $arrquery[$x]
WEnd

$x=$x-1
ReDim $arrquery[$x]
_ArrayDisplay( $arrquery, "Unsorted")
_ArraySort( $arrquery)
FileClose($sqlquery)

For $remove = 25 to 1 step -1
    $pos = _arraysearch($arrquery, $remove)
    If $pos=-1 Then
    ;Do nothing
    Else
        _ArrayDelete($arrquery, $pos)
    EndIf
Next

For $x= 0 to _ArrayMaxIndex( $arrquery, 1)
    RunWait( @comspec & " /c sqlcmd -U sa -P " & $sqlSApwd & " -S " & $sqlServerName & " -d [i]database[/i] -i """ & $arrquery[$x] & """)
Next

Some notes.

The _arraydisplay will come ou in the final code.

The reason for removing items from the array, is there are actually around 46 query files, but we only need the last 20 or so.

Also, the quotes in the runwait at the end are needed, as the query files have names like "26 Create AuditTrail Database & Tables.sql"

Thanks for any help,

Jason

Share this post


Link to post
Share on other sites



OK, been doing some work on this, adding bit-by-bit to the code, and recompiling.

This only fails if the runwait command is there. Once that is commented out, it works without a problem. The obvious issue is that I need the runwait to execute the sqlcmd.....

Any ideas?

Thank you,

Jason A.

Share this post


Link to post
Share on other sites

m0ng0l.h0rde = ID10T.....

Found the problem, I had one to few quotes to close out the Runwait command line.....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0