NewsArchive
11-15-2007, 03:04 AM
I have an install script which installs our app as well as SQL express. I
am using Run Command Line twice, neither of which appears to be working.
At the beginning of the install, I am checking to see if express is already
installed, and if so, is my instance there (hence, update). I am using bcp
to get a list of instances as follows:
Run Command Line
bcp "SELECT name FROM sys.Databases WHERE name = '%TP_DBNAME%'" queryout
%TMPDIR%\TCS_DBlist.txt -c -U %TCS_SQL_LOGIN% -P %TCS_SQL_PWD% -S
%PC_NAME%\%INSTANCENAME%
(x) wait for program
Once the complete installation is done, I am trying to update a record in
the database to "activate" everything as follows: (had to break it up,
because run field is not big enough to hold all the text)
Set Variable %SQL_CMD_PRE%
-U "%TCS_SQL_LOGIN%" -P "%TCS_SQL_PWD%" -S "%PC_NAME%\%INSTANCENAME%" -d
"%TP_DBNAME%" -o "%_SB_INSTALLDIR%\TCS_DBreg.txt"
Set Variable %SQL_CMD_SUF%
-Q "update Registration set
REG_SerialNumber='0000000000',REG_MembershipNumber ='0000000000' WHERE
REG_SiteID='1'"
Run Command Line
sqlcmd %SQL_CMD_PRE% %SQL_CMD_SUF%
(x) wait for program
Both of these display messages so I can see that all the vars are being set
properly, and they are. I even wrote out the resulting commands to txt
files, so I could run them myself, and they work flawlessly from the Windows
CMD prompt.
I put the resulting commands in an INI (so I could edit them) along with the
%_SB_ERRORCODE% generated.
Here are the two lines, with their error codes:
bcp "SELECT name FROM sys.Databases WHERE name = 'TirePower-Demo'" queryout
C:\DOCUME~1\ADMINI~1.TCS\LOCALS~1\Temp\TCS_DBlist. txt -c -U ####### -P
####### -S TCS_TEST_01\TCS_SYSTEMS
Error=1
sqlcmd -U "########" -P "########" -S "TCS_TEST_01\TCS_SYSTEMS" -d
"TirePower-Demo" -o "C:\Program Files\Tire Company Solutions\Tire Power
Demo\TCS_DBreg.txt" -Q "update Registration set
REG_SerialNumber='0000000000',REG_MembershipNumber ='0000000000' WHERE
REG_SiteID='1'"
Error=1
Glenn Paschal
am using Run Command Line twice, neither of which appears to be working.
At the beginning of the install, I am checking to see if express is already
installed, and if so, is my instance there (hence, update). I am using bcp
to get a list of instances as follows:
Run Command Line
bcp "SELECT name FROM sys.Databases WHERE name = '%TP_DBNAME%'" queryout
%TMPDIR%\TCS_DBlist.txt -c -U %TCS_SQL_LOGIN% -P %TCS_SQL_PWD% -S
%PC_NAME%\%INSTANCENAME%
(x) wait for program
Once the complete installation is done, I am trying to update a record in
the database to "activate" everything as follows: (had to break it up,
because run field is not big enough to hold all the text)
Set Variable %SQL_CMD_PRE%
-U "%TCS_SQL_LOGIN%" -P "%TCS_SQL_PWD%" -S "%PC_NAME%\%INSTANCENAME%" -d
"%TP_DBNAME%" -o "%_SB_INSTALLDIR%\TCS_DBreg.txt"
Set Variable %SQL_CMD_SUF%
-Q "update Registration set
REG_SerialNumber='0000000000',REG_MembershipNumber ='0000000000' WHERE
REG_SiteID='1'"
Run Command Line
sqlcmd %SQL_CMD_PRE% %SQL_CMD_SUF%
(x) wait for program
Both of these display messages so I can see that all the vars are being set
properly, and they are. I even wrote out the resulting commands to txt
files, so I could run them myself, and they work flawlessly from the Windows
CMD prompt.
I put the resulting commands in an INI (so I could edit them) along with the
%_SB_ERRORCODE% generated.
Here are the two lines, with their error codes:
bcp "SELECT name FROM sys.Databases WHERE name = 'TirePower-Demo'" queryout
C:\DOCUME~1\ADMINI~1.TCS\LOCALS~1\Temp\TCS_DBlist. txt -c -U ####### -P
####### -S TCS_TEST_01\TCS_SYSTEMS
Error=1
sqlcmd -U "########" -P "########" -S "TCS_TEST_01\TCS_SYSTEMS" -d
"TirePower-Demo" -o "C:\Program Files\Tire Company Solutions\Tire Power
Demo\TCS_DBreg.txt" -Q "update Registration set
REG_SerialNumber='0000000000',REG_MembershipNumber ='0000000000' WHERE
REG_SiteID='1'"
Error=1
Glenn Paschal