4D v13.4

ALTER DATABASE

Home

 
4D v13.4
ALTER DATABASE

ALTER DATABASE  


 

 

ALTER DATABASE {ENABLE | DISABLE} {INDEXES | CONSTRAINTS}

The ALTER DATABASE command enables or disables SQL options of the current database for the current session. 

This command is intended to allow you to temporarily disable SQL options in order to accelerate certain operations that take up a lot of resources. For example, disabling indexes and constraints before beginning the import of a large quantity of data can significantly reduce the duration of the import. Note that constraints include primary keys and foreign keys as well as unique and null attributes. 

ALTER DATABASE applies to the entire database. In other words, if a user disables an option, it will be disabled for all the users of the database.

Example  

Example of an import with temporary disabling of all SQL options:

 Begin SQL
    ALTER DATABASE DISABLE INDEXES;
    ALTER DATABASE DISABLE CONSTRAINTS;
 End SQL
 SQL EXECUTE SCRIPT("C:\Exported_data\Export.sql";SQL On error continue)
 Begin SQL
    ALTER DATABASE ENABLE INDEXES;
    ALTER DATABASE ENABLE CONSTRAINTS;
 End SQL

 
PROPERTIES 

Product: 4D
Theme: SQL Commands