\
Tips and Tricks
Tools
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>
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]