MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: SC.EXE[Next]: Patch Applicability Browser
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Tools->OSQL.EXE

OSQL.EXE

This is a MS tool, not sure what installs it. It can apply ".sql" files to databases.

The following example uses this tool via the "RunCmd" command:

;--- Use existing ".SQL" file -----------------------------------------------
<$Sql file="Update.SQL" Command=^"osql.exe" -E -b -n -w512 -S . -d "DatabaseName" -i "{?}"^>

;--- .SQL inline ------------------------------------------------------------
#define MySqlCmd  osql.exe -E -b -n -w512 -S . -d "DatabaseName" -i "{?}"
<$Sql Command=^<$MySqlCmd>^>
   Delete from
       INF_Router
   Where
       ID_Process = 18 and ProcessName = 'GetAllDBUsers'
   GO

   Delete from
       INF_Error
   Where
       ID_Source = 'Operator.GetXMLForAllDBOperators'
   GO
<$/Sql>
<$Sql Command=^<$MySqlCmd>^>
      #include "SqlPart1.SQL"
      #include "SqlPart2.SQL"
<$/Sql>

OSQL.EXE -?

usage: osql              [-U login id]          [-P password]
  [-S server]            [-H hostname]          [-E trusted connection]
  [-d use database name] [-l login timeout]     [-t query timeout]
  [-h headers]           [-s colseparator]      [-w columnwidth]
  [-a packetsize]        [-e echo input]        [-I Enable Quoted Identifiers]
  [-L list servers]      [-c cmdend]            [-D ODBC DSN name]
  [-q "cmdline query"]   [-Q "cmdline query" and exit]
  [-n remove numbering]  [-m errorlevel]
  [-r msgs to stderr]    [-V severitylevel]
  [-i inputfile]         [-o outputfile]
  [-p print statistics]  [-b On error batch abort]
  [-X[1] disable commands [and exit with warning]]
  [-O use Old ISQL behavior disables the following]
      <EOF> batch processing
      Auto console width scaling
      Wide messages
      default errorlevel is -1 vs 1
  [-? show syntax summary]


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: SC.EXE[Next]: Patch Applicability Browser


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.