SET DEFAULT
Syntax
SET DEFAULT [DATABASE | ORGANIZATION | ROLE | SCHEMA | STORE] object_name;Description
This sets the database, organization, role, schema, or store as the user’s default. Changing defaults does not affect the current session’s context, and you can use USE to change the current context.
Entering a new user session has the same affect as changing it with USE.
Any object used to set as default must already exist and be accessible by the user.
Arguments
object_name
Name of the entity to set as a default. If the name is case sensitive you must wrap it in double quotes; otherwise, the system uses the lowercase name.
Examples
Set a new default database
The following changes the user’s default database to user_db:
main_db.public/demostore# LIST DATABASES;
+---------+-------------+----------+-------------------------------+
| Name | Is Default | Owner | Created At |
+=========+=============+==========+===============================+
| user_db | false | orgadmin | 2024-06-05 19:41:23 +0000 UTC |
+---------+-------------+----------+-------------------------------+
| main_db | true | sysadmin | 2023-08-09 21:28:40 +0000 UTC |
+---------+-------------+----------+-------------------------------+
main_db.public/demostore# SET DEFAULT DATABASE user_db;
+---------+---------+----------+------------------------------------------+
| Type | Name | Command | Summary |
+=========+=========+==========+==========================================+
| default | user_db | UPDATE | Default database was successfully |
| | | | updated to user_db |
+---------+---------+----------+------------------------------------------+Set a new default schema
The following changes the user’s default schema to demodb.Analytics within the current database, demodb:
Set a new default store
The following changes the user’s default store to sf_east_2 for future sessions:
Set a new default role
The following changes the user’s default role to useradmin for future sessions:
Set a new default organization
The following changes the user’s default organization to mr_prod, using its ID field, for future sessions:
Last updated

