USE

Transact SQL USE statement Snowflake equivalence.

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