UltraLite ALTER DATABASE SCHEMA FROM FILE statement

Use this statement to modify the schema definition of an existing UltraLite database using a SQL script.

Syntax
ALTER DATABASE SCHEMA FROM FILE filename
Parameters

filename   Defines the name and path to the SQL script used to upgrade the schema of an existing UltraLite database.

Remarks

Use either ulinit or ulunload to extract the DDL statements required for your script. By using these utilities, you ensure that the DDL statements are syntactically correct. Use ulinit (-l logfile option) or ulunload (using the -n -s output-file options). See UltraLite Initialize Database utility (ulinit), and UltraLite Unload Database utility (ulunload).

Backup the database before executing this statement.

The character set of the SQL script file must match the character set of the database you want to upgrade.

Ensure that your device is not reset while this statement is executing. If you reset the device during a schema upgrade, the UltraLite database becomes unusable.

Any rows that do not fit into the schema will be dropped (for instance if a uniqueness constraint is added and multiple rows contain the same values, all but one row will be dropped). In this case, the SQLE_ROW_DROPPED_DURING_SCHEMA_UPGRADE warning is generated. You can use this warning to detect the error and restore the database from the backup version.

See also
Example

The following statement modifies the schema of the database using a SQL script, MySchema.sql:

ALTER DATABASE SCHEMA FROM FILE 'MySchema.sql';