CREATE OR ALTER | Snowflake Documentation (original) (raw)

CREATE OR ALTER commands are DDL commands that combine the functionality of the CREATE command and the ALTER command, enabling you to define an object using the syntax supported by the CREATE command with the limitations of the ALTER command.

The commands maintain data and associations, meaning that data and other states, tag associations and attached policies, and privilege grants on the object are preserved. However, some object transformations can result in dropped data. For example, if a CREATE OR ALTER TABLE statement results in a dropped column, any data contained in the column is lost (but can still be recovered with Time Travel).

CREATE OR ALTER commands enable you to apply incremental updates to objects using a declarative, idempotent method. When executed, a CREATE OR ALTER statement results in one of these outcomes:

See also:

CREATE , ALTER

CREATE OR ALTER commands

For specific syntax, usage notes, and examples, see:

Account Objects:

Database Objects:

General usage notes

Limitations

The specific limitations of the CREATE OR ALTER command depend on the object. Some examples of limitations are as follows:

For the limitations for a specific object, see the reference topic for the object.

Example use case

If you have SQL scripts that set up Snowflake objects for an application, you can use CREATE OR ALTER statements in your scripts to make it easier to deploy changes across development, testing, and production environments. As the application evolves, you can make modifications to the script.

By using a CREATE OR ALTER statement, you can run the script in a new environment, while also re-running the script in an existing environment, letting you write the desired object definition once and apply it across environments.