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 TABLE "MYSCHEMA"."MYTABLE" (
"COL1" INT DEFAULT MYSCHEMA.MYTABLE_COL1.NEXTVAL /*** MSC-WARNING - MSCEWI2031 - SEQUENCE -  GENERATED BY DEFAULT  START 1 INCREMENT 1 ***/ NOT NULL,
"COL2" INT,
"COL2 COL3 COL4" VARCHAR,
"COL VARCHAR_SPANISH" VARCHAR(20) COLLATE 'ES-CI-AI' DEFAULT 'HOLA',
"COL VARCHAR_LATIN" VARCHAR(20) COLLATE 'EN-CI-AI' DEFAULT 'HELLO'
);

Temporary Tables

In the source cody there can be some tables names that start with the character #.

If that is the case, they are transformed to temporary tables in the output code.

Le'ts 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.

Collate

ENCRYPTED 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.

Source

Output

On Primary

The ON PRIMARY option is not supported in Snowflake, so it is being removed and a warning has been added.

Source

Output

ASC/DESC Column Sorting

The column sorting is not supported in Snowflake, the ASC or DESC keywords are being commented out. A warning is added.

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 could not 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

Masking is not currently supported in Snowflake as the way it does in SQL Server. There is no direct translation for masking at this moment, so, a warning is added in those cases. For example:

Input

Output

For more information related to masking in Snowflake, you could visit this documentation.

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

Last updated

Was this helpful?