PRIMARY KEY

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

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

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