PDA

View Full Version : Problems with Command line order



NewsArchive
10-06-2010, 12:42 AM
If i run this order from the command line after my install, it does
what it is supposed to do:
sqlcmd -S EDVARD-18E7D08F\EASYPLAN -U SA -P Easy#plan!2010 -i
c:\Easyplan\data\Create_Easyplan_db.sql,c:\Easypla n\data\NewDanish04082010.sql

Runs two sql scripts, the first creates a DB in a installed MSSQL 2005
express server, and the second creates the tables etc.

If i instead uses this in the install:

Install File "J:\easyflex\SQL Scripts\Create_Easyplan_db.sql" to
"%DATAFOLDER%\Create_Easyplan_db.sql" (Always Install)
Install File "J:\easyflex\SQL Scripts\NewDanish04082010.sql" to
"%DATAFOLDER%\NewDanish04082010.sql" (Always Install)
Run Command Line sqlcmd -S EDVARD-18E7D08F\EASYPLAN -U SA -P
Easy#plan!2010 -i
c:\Easyplan\data\Create_Easyplan_db.sql,c:\Easypla n\data\NewDanish04082010.sql
[Wait]


%datafolder% is set to:
Set Variable %DATAFOLDER% to "C:\EASYPLAN\DATA"

Nothing happens

The example is run in Windows XP, Servicepack 3 on a WMware 6.5

In the final script, i would change -S EDVARD-18E7D08F\EASYPLAN to -S
%servername%, but this has been made to errorcheck.

Any good suggestions?

Edvard Korsbęk

NewsArchive
10-06-2010, 12:43 AM
I'd suggest to check the error code to make sure it is really executed.
"Run Command Line" is a wrapper around the CreateProcess API, so I think
Windows does not find "sqlcmd" in your case.

If the function succeeds, the %_SB_ERRORCODE% return value is zero. If the
function fails, the return value is a system error code. A return value of
259 means the application is still running!

And I would use "sqlcmd.exe" (or even better the full qualified path name)
instead of sqlcmd.

Hope this helps.

Friedrich

NewsArchive
10-06-2010, 12:43 AM
I changed to the full qualified path, and that made the trick.
Thanks!

Edvard Korsbęk