USE
Transact SQL USE statement Snowflake equivalence.
The USE statement has its own equivalent in Snowflake. If the user wants to transform this statement, he has to specify the -u
or -usedatabase
flag in the conversion tool. The statement will be translated to the USE DATABASE statement in snowflake.
Translation Examples
Source
USE [MY DATABASE]
Output
USE DATABASE "MY DATABASE"
Source
USE [MY DATABASE]
Output
-- ** MSC-WARNING - MSCEWI4001 - Transformation for USE <database> is disabled by default. **
--USE "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. Example:
Source
USE [MY DATABASE]
CREATE TABLE [TableName1].[TableName2](
[ColumnName1] varchar NULL
);
Output
USE DATABASE MYCUSTOMDB;
CREATE TABLE "TableName1"."TableName2"(
"ColumnName1" VARCHAR NULL
);
Last updated
Was this helpful?