Support Files

Database to SQL Script Utility

The Database to SQL Script utility will produce an SQL Script from any given PLEXOS Database, (both Input and Solution databases), which will create and populate an SQL Database with the corresponding schema and data. It currently creates Primary Keys, Foreign Key Relationships and Unique Constraints.

Command Line Usage

> DataSetToSQL --help
DatasetToSQL [--drop] [--target=] [--progress] [--compress]
can be an input database (*.xml) or a Solution database (*.zip)
--drop Generate SQL to DROP the database if it already exists.
--target= Generates SQL supported by a specific DBMS. (default=sqlserver)
Valid values are: sqlserver, mysql
--progress Generates progress messages in the SQL Script.
--compress Writes the output file to a ZIP archive.

DBMS Support

At the present time, SQL Server and MySQL are fully supported. Use the –target command line argument to specify which DBMS you intend to run the script for.

Usage Notes

The sql script generated may be quite large. It may be necessary, therefore, to execute the resulting script from the command line, using sqlcmd with the –i argument in SQL Server, or with the mysql command line in MySQL.

Examples:
sqlcmd –i script.sql
mysql –u=root < script.sql

To reduce file size, you can use the –compress option to write to a .zip file. There is also the option to output only a specific class. Use this in conjunction with –dataonly to generate INSERTs for the t_data tables only, omitting objects, memberships (etc) which may have been exported in a previous execution of the DatasetToSQL utility.