m0ng0l.h0rde Posted October 25, 2006 Share Posted October 25, 2006 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 Link to comment Share on other sites More sharing options...
m0ng0l.h0rde Posted October 25, 2006 Author Share Posted October 25, 2006 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. Link to comment Share on other sites More sharing options...
m0ng0l.h0rde Posted October 25, 2006 Author Share Posted October 25, 2006 m0ng0l.h0rde = ID10T..... Found the problem, I had one to few quotes to close out the Runwait command line..... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now