Command Line

Command Line

Command Line Modes

gsqlcmd [execute] <connection> <sql query | file> [<output file>] [<options>]
gsqlcmd  prepare  <connection> <sql query | file> [<output file>] [<options>]
gsqlcmd  parse    <connection> <sql query | file> [<output file>] [<options>]

gsqlcmd  insert   <connection> <csv file>  [<output file>] [<options>]
gsqlcmd  update   <connection> <csv file>  [<output file>] [<options>]
gsqlcmd  delete   <connection> <csv file>  [<output file>] [<options>]
gsqlcmd  merge    <connection> <csv file>  [<output file>] [<options>]

gsqlcmd  fmt+                  <csv file>                  [<options>]
gsqlcmd  fmt                   <csv file>  [<output file>] [<options>]
gsqlcmd  create|bulk|ini|ace   <csv file>  [<output file>] [<options>]

gsqlcmd  createSqlCe35|createSqlCe40 <file>
gsqlcmd  createSQLite3               <file>

gsqlcmd  localconfig | userconfig | appconfig
gsqlcmd  connections
gsqlcmd  show     <connection> [servertype|server|database|filename|authentication|username|password]

gsqlcmd  stamp [<datetime format>]

gsqlcmd  version [<version>]
gsqlcmd  register

gsqlcmd  help  [chm]

<Connection> Format

<ConnectionString name>              ConnectionString name from gsqlcmd.exe.config
or <ConnectionString>                ConnectionString for OLEDB, ODBC, and DSN
or <ProviderName>;<ConnectionString> ConnectionString for .NET providers

Query Execution Options

/commandTimeout=<seconds>
/connectionTimeout=<seconds>
/noTransaction
/inputCodepage=<codepage>
/outputCodepage=<codepage>
/outputCulture=<name>
/noBOM
/set=<parameter>=<value | function>[;...]
/trace
/fromFiles=<mask>

Functions for /set and /add parameters

UtcNow() | UtcDateTime()
UtcDate()
UtcTime()
Now() | DateTime()
Date()
Time()
NyseDateTime()
NyseDate()
NyseTime()
FileDateTime(<file>)
FileDateTimeUtc(<file>)
FileDateTimeNyse(<file>)
FileDate(<file>)
FileDateUtc(<file>)
FileDateNyse(<file>)
FileTime(<file>)
FileTimeUtc(<file>)
FileTimeNyse(<file>)
FileName(<file>)
FileNameWithoutExtension(<file>)
FileText(<file>)
FileNameDateTime(<file>)
FileNameDate(<file>)
FileNameTime(<file>)

Common Output Options

/addRowNum
/append
/asText
/asCsv
/asHtml
/dateTimeFormat=<format>
/noHeaders
/toFiles

CSV Input Options

/inputSeparator=<separator>|Tab
/inputDateFormat=DMY|MDY
/firstRow=<first row>

CSV Output Options

/add=<header=value | function>[<separator>...]
/[output]Separator=<separator>|Tab
/qouteChar=<char>
/escapeChar=<char>

HTML Output Options

/noTemplate
/placeholder=<placeholder>
/template=<HTML template file>
/title=<title>

Code Generation Options

/table=<target database table | view | stored procedure> | <SQL template file>
/fmt=<format file>
/insertIdentity
/insertNulls
/singleLineSQL
/groupSize=<number of rows>
/keys=<field>[,<field>[,...]]
/mssql | /sqlce | /mysql | /oracle | /db2 | /nuodb | /pgsql | /sqlite

Exit Codes

Exit CodeDescription
0Success
1Incomplete command line parameters
2Wrong command line parameters
3Exceptions occurred
4Database server returns an error
This website is using cookies. By continuing to browse, you give us your consent to our use of cookies as explained in our Cookie Policy.