Commandline
SQL Pretty Printer can be executed in command line with name sqlpp_cmd.exe. you can specify any configuration file including format options. You can set format options in GUI version, and share those format options with command line tool by configuration file.
The simplest way to use this program is something like this:
c:\sqlpp_cmd filename.sql
This will print the beautified SQL to the stand output.
c:\sqlpp_cmd filename.sql -out
this will output a beautified file with name filename.spp. and a log file also created with name sqlpp.log.
c:\sqlpp_cmd -R -inplace -sql -mssql -config=sqlpp.ini sqldir
this will beautify all files under sqldir with file extension of sql using format options in sqlpp.ini.
and a log file also created with name sqlpp.log.
Syntax: sqlpp_cmd [options] path/filename
Parameters to the command-line program:
Mode of source:
-F Format a file. The file name must be specified.
-D Format a directory. The directory name must be specified.
-R Format a directory tree. The root directory name must be specified.
Output type:
-sqloutput create formatted sql output
-htmloutput create html output use span attribute
-html2output create html output use font attribute
-xmloutput create xml output
-dbobjectoutput create output for db objects in sql script
If no output type is specified, sqloutput mode will be used.
How to save output:
-inplace change the source file without backup
-out output to a new file(with the file extension : .spp(output type is sqloutput) or .htm (ouutput type is html) or .dbobject.txt(output type is dbobject)
-stdout standard output to dos
-backup change the file and leave the original file as a backup(with the file extension : spp)
If no output mode is specified, stdout mode will be used.
file type to process:
-all process all files
-txt process all txt files
-sql process all sql files
If no file type is specified, all file will be processed.
Database options :
-generic for most sql99 syntax
-mssql
-mysql
-oracle
-db2
-access Ms access
If no database is specified, generic type will be used.
Configuration file:
-config=filename
Read format option from configuration file. this will overwrite the database options and output type specified in command line.
|