USE

Transact-SQL USE statement Snowflake equivalence.

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Applies to

The USE statement has its own equivalent in Snowflake. The statement will be translated to the USE DATABASE statement in Snowflake.

Translation Examples

Source

IN -> SqlServer_01.sql
USE [MY DATABASE]

Output

OUT -> SqlServer_01.sql
USE DATABASE "MY DATABASE";

Database name

The database name specified in the USE statement, could have a change if it comes inside Square Brackets ([ ]). The first bracket and the last bracket will be replaced with quotes. Example:

Source

[MYDATABASE]
[[[MYDATABASE]]

Output

"MYDATABASE"
"[[MYDATABASE]"

User Defined Database

If a user specifies to the Conversion Tool a custom database name to be applied to all the objects by using the -d parameter, and wants the USE statements to be transformed, the Database name should be applied just to the USE statement and not to the objects. This will override the specified database from the use statement. Example:

Source

IN -> SqlServer_02.sql
-- Additional Params: -d MYCUSTOMDB
USE [MY DATABASE]

CREATE TABLE [TableName1].[TableName2](
	[ColumnName1] varchar NULL
);

Output

OUT -> SqlServer_02.sql
-- Additional Params: -d MYCUSTOMDB
USE DATABASE MYCUSTOMDB;

CREATE OR REPLACE TABLE MYCUSTOMDB.TableName1.TableName2 (
	ColumnName1 VARCHAR NULL
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
;

Known Issues

No issues were found.

No related EWIs.

Last updated