Tables
Basic Create Table
Source
CREATE TABLE [MYSCHEMA].[MYTABLE]
(
[COL1] INT IDENTITY (1,1) NOT NULL,
[COL2] INT,
[COL2 COL3 COL4] VARCHAR,
[COL VARCHAR_SPANISH] [VARCHAR](20) COLLATE Modern_Spanish_CI_AI DEFAULT 'HOLA',
[COL VARCHAR_LATIN] [VARCHAR](20) COLLATE Latin1_General_CI_AI DEFAULT 'HELLO'
);Expected
CREATE OR REPLACE SEQUENCE MYSCHEMA.MYTABLE_COL1
START WITH 1
INCREMENT BY 1
COMMENT = 'FOR TABLE-COLUMN MYSCHEMA.MYTABLE.COL1';
CREATE OR REPLACE TABLE MYSCHEMA.MYTABLE (
COL1 INT DEFAULT MYSCHEMA.MYTABLE_COL1.NEXTVAL NOT NULL,
COL2 INT,
"COL2 COL3 COL4" VARCHAR,
"COL VARCHAR_SPANISH" VARCHAR(20) COLLATE 'ES-CI-AI' /*** SSC-PRF-0002 - CASE INSENSITIVE COLUMNS CAN DECREASE THE PERFORMANCE OF QUERIES ***/ DEFAULT 'HOLA',
"COL VARCHAR_LATIN" VARCHAR(20) COLLATE 'EN-CI-AI' /*** SSC-PRF-0002 - CASE INSENSITIVE COLUMNS CAN DECREASE THE PERFORMANCE OF QUERIES ***/ DEFAULT 'HELLO'
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
;Temporary Tables
In the source code, there can be some table names that start with the character #.
If that is the case, they are transformed into temporary tables in the output code.
Let's see how the code from above would be migrated.
As you can see, TEMPORARY was added to the definition of the table, and the character # was replaced with T_.
Also, all references of the table will be transformed too, to match the new name given to the temporary table.
NULL and NOT NULL Column Option
NULL and NOT NULL column options are supported in Snowflake.
Source
Expected
Identity Column Option
For identity columns, a sequence is created and assigned to the column.
Source
Expected
For more information, you can also check this warning related to this transformation.
Default Column Option
The default Expr is supported in Snowflake, however, in SqlServer it can come together with a constraint Name. Since that part is not supported in Snowflake, it is removed and a warning is added.
Source
Expected
Column Constraint
Source
Expected
Collate Column Option
For the transformation of Collate, please check the following link.
CollateENCRYPTED WITH Column Option
The Encrypted With is not supported in Snowflake, so it is being removed and a warning is added.
Source
Expected
NOT FOR REPLICATION
The NOT FOR REPLICATION option is not supported in Snowflake. It is used for the identity that is being migrated to a SEQUENCE.
Notice that NOT FOR REPLICATION is a statement that is not required in Snowflake because it is translated to an equivalent, so it is removed.
Source
Output
On Primary
The ON PRIMARY option is a statement that is used in SQL Server to define on which file an object, e.g. a table, is going to be created. Such as on a primary or secondary file group inside the database. Snowflake provides a different logic and indicates distinct constraints. Please review the following Snowflake documentation for more information.
Source
Output
ASC/DESC Column Sorting
The column sorting is not supported in Snowflake, the ASC or DESC keywords are being removed.
Source
Output
Computed Columns
Computed columns are supported in Snowflake, we just need to add the explicit data type in order to be able to deploy the table, for example.
Source
Output
If the computed expression cannot transformed, a warning is added, and a simple column definition with the expression return type will be used instead, like in the following example:
Source
The expression CONVERT ([NUMERIC], ExpressionValue) is not supported yet by SnowConvert, so, after it is inspected, SnowConvert will determine that its type is XML, so the transformation will be
SnowConvert will run a process to determine the original expression type in SQLServer. However, the column will have the equivalent target type. In the previous example, the column type in SQLServer was XML, but the target type in Snowflake for storing an XML is TEXT. For more information about data type mapping check the data types sections.
MASKED WITH Column Option
In SQL Server the data masking is used to keep sensitive information from nonprivileged users. Review the SQL SERVER documentation for more information. In Snowflake, there is a dynamic data masking functionality but it is available to Enterprise Edition only. Please, review the following Snowflake documentation.
Input
Output
ROWGUIDCOL Column Option
ROWGUIDCOL is no longer applicable in Snowflake. It is used in SQL Server for UNIQUEIDENTIFIER types that are currently translated to VARCHAR. For example:
Input
Output
GENERATED ALWAYS AS ROW START/END Column Option
ROW START/END is not supported in Snowflake. An error is added when SnowConvert try to transform this kind of column option.
Input
Output
Related EWIs
SSC-EWI-0036: Data type converted to another data type.
SSC-EWI-0040: Statement Not Supported.
SSC-EWI-0073: Pending Functional Equivalence Review.
SSC-EWI-TS0003: Encrypted with not supported in Snowflake.
SSC-EWI-TS0013: Computed column transformed.
SSC-EWI-TS0017: Masking not supported.
SSC-FDM-TS0009: Encrypted with not supported in Snowflake.
SSC-FDM-0012: Constraint in default expression is not supported.
SSC-FDM-TS0002: This message is shown when there is a collate clause that is not supported in Snowflake.
SSC-PRF-0002: Case-insensitive columns can decrease the performance of queries.
Last updated