PRIMARY KEY

Description

Some parts in the output code are omitted for clarity reasons.

SQL Server primary key has many clauses that are not applicable for Snowflake. So, most of the statement will be commented out.

Syntax in SQL Server

{ PRIMARY KEY | UNIQUE }   
[ CLUSTERED | NONCLUSTERED ]   
(column [ ASC | DESC ] [ ,...n ] )  
[ WITH FILLFACTOR = fillfactor   
[ WITH ( <index_option>[ , ...n ] ) ]  
[ ON { partition_scheme_name ( partition_column_name ... )  
  | filegroup | "default" } ]   

Syntax in Snowflake

[ CONSTRAINT <constraint_name> ]
{ UNIQUE | PRIMARY KEY } ( <col_name> [ , <col_name> , ... ] )
[ [ NOT ] ENFORCED ]
[ [ NOT ] DEFERRABLE ]
[ INITIALLY { DEFERRED | IMMEDIATE } ]
[ ENABLE | DISABLE ]
[ VALIDATE | NOVALIDATE ]
[ RELY | NORELY ]

Sample Source Patterns

Notice that WITH FILLFACTOR statement has been removed from the translation because it is not relevant in Snowflake syntax.

SQL Server

IN -> SqlServer_01.sql
ALTER TABLE Production.TransactionHistoryArchive
   ADD CONSTRAINT PK_TransactionHistoryArchive_TransactionID PRIMARY KEY 
   CLUSTERED (TransactionID)
   WITH (FILLFACTOR = 75, ONLINE = ON, PAD_INDEX = ON)
   ON "DEFAULTLOCATION";

Snowflake

OUT -> SqlServer_01.sql
ALTER TABLE Production.TransactionHistoryArchive
   ADD CONSTRAINT PK_TransactionHistoryArchive_TransactionID PRIMARY KEY (TransactionID);

Known Issues

No issues were found

No related EWIs.

Last updated