Space in Table names & Alias names - SQL Server to Snowflake Migration

Table name with space in it:

Microsoft SQL Server allows space in the table name and column names:

CREATE TABLE [EMPLOYEE DETAILS]
(
[EMP NAME] VARCHAR(100)
);

Snowflake equivalent:

CREATE TABLE "EMPLOYEE DETAILS"
(
"EMP NAME" VARCHAR(100
);

Alias name with space:

SQL Server:

SELECT  [EMPLOYEE TABLE].ID FROM EMPLOYEE AS [EMPLOYEE TABLE]

Snowflake equivalent:

SELECT "EMPLOYEE TABLE".ID FROM EMPLOYEE AS "EMPLOYEE TABLE"

Alias name enclosed in single quote

SQL Server:

select 'Calvin' AS 'Employee Name'

Snowflake equivalent:

select 'Calvin' AS "Employee Name"

Column Alias name assigned using = sign

SQL Server:

select [Employee Name] = 'Calvin'

Snowflake equivalent:

select 'Calvin' AS "Employee Name"
(* This conversion is not supported by the tool at this time) 

NOTE: Column names enclosed in double quotes in Snowflake are case sensitive, meaning you have to use the exact same case in your queries

Cpaul

posted on 20 Feb 21

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds