Command Line Modes

Command Line Modes

Execute

gsqlcmd executes the specified SQL query or SQL script against the specified connection.

Use this mode to execute queries, export and import data.

You may omit the "execute" keyword. gsqlcmd uses this mode by default.

Prepare

gsqlcmd prepares the specified SQL query or SQL script to execute against the specified connection.

You may execute the result code in the execute mode or with another query tool.

Parse

gsqlcmd parses the specified SQL query or SQL script using the specified connection.

Use this mode to check how gsqlcmd parses queries into SQL commands.

Insert, Update, and Delete

gsqlcmd generates SQL statements for the specified CSV file.

Use the /table option to specify the target table, view, stored procedure, or SQL template file, and the /fmt= option to specify the format file with actual column names.

You may execute the generated SQL script using the execute mode.

The free version has a limit of 50 rows.

Merge

gsqlcmd generates insert and update SQL statements to merge data from the specified CSV file.

Use the /table option to specify the target table or view, and the /fmt= option to specify the format file with actual column names.

You may execute the generated SQL script using the execute mode.

The free version has a limit of 50 rows.

Fmt+

gsqlcmd generates configuration files for importing CSV files to Microsoft SQL Server using different techniques.

This mode is equivalent to a set of commands: Fmt, Create, Ace, Buck, and Ini.

If the format file exists, gsqlcmd uses it as a column name source. Otherwise, it creates a new format file.

Usually, you run gsqlcmd in this mode twice: the first for generating all files as is and the second after editing the format file.

Fmt

gsqlcmd generates format files for importing CSV files into Microsoft SQL Server using the OPENROWSET(BUCK...) function.

Also, gsqlcmd uses the format files as a column name sources in other modes.

Create

gsqlcmd generates CREATE TABLE statements to create tables to import CSV data.

Use the /table option to specify the target table and the /fmt= option to specify the format file with actual column names.

Ace

gsqlcmd generates OPENROWSET statements to import CSV data using the MICROSOFT.ACE.OLEDB.12.0 provider.

Use the /table option to specify the target table and the /fmt= option to specify the format file with actual column names.

You may use the OPENROWSET statements with the MICROSOFT.ACE.OLEDB.12.0 provider to import CSV data in the UTF-8 encoding.

Bulk

gsqlcmd generates OPENROWSET(BULK...) statements to import CSV data into Microsoft SQL Server.

Use the /table option to specify the target table and the /fmt= option to specify the format file with actual column names. 

Ini

gsqlcmd generates the schema.ini file used to import CSV data into Microsoft Excel and databases using ODBC drivers.

Use the /fmt= option to specify the format file with actual column names.

createSqlCe35|createSqlCe40

gsqlcmd creates an SQL Compact database with a specified file name.

createSQLite3

gsqlcmd creates an SQLite database a specified file name.

LocalConfig | UserConfig | AppConfig

gsqlcmd starts gConnectionManager to edit named connections in configuration files:

  • LocalConfig - gsqlcmd.exe.config in the current directory.
  • UserConfig - gsqlcmd.exe.config in the %LocalAppData%\Gartle\gsqlcmd folder.
  • AppConfig - gsqlcmd.exe.config in the gsqlcmd install folder.

Connections

gsqlcmd lists connections from all configuration files described above.

Show

gsqlcmd shows connection properties.

Stamp

Use this mode in batch files to set environment variables:

for /F %%i in ('gsqlcmd.exe stamp') do set stamp=%%i

Version

gsqlcmd shows the current version.
If the version parameter is specified, the app returns the following exit code:
3 - the required version is greater;
2 - the required version cannot be parsed;
0 - the required version is below or equal.

Register

gsqlcmd launches the Registration Wizard.

Help

gsqlcmd prints the extended command line help or starts this CHM help file for the chm parameter.

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.