The default Expr is supported in Snowflake, however, in Sql Server it can come together with a constraint Name. Since that part is not supported in Snowflake, it has been removed, and a warning has been added.
:force:
CREATEORREPLACETABLE SCHEMA1.TABLE1 (
COL1 VARCHAR(10)DEFAULT('0')/*** SSC-FDM-0012 - CONSTRAINT NAME 'constraintName' IN DEFAULT EXPRESSION CONSTRAINT IS NOT SUPPORTED IN SNOWFLAKE ***/NOTNULL)COMMENT='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}';
Snowflake supports CHECK constraints with deterministic, scalar expressions. SnowConvert AI migrates SQL Server CHECK constraints to Snowflake, handling dialect-specific clauses and detecting unsupported expressions.
Supported:
Basic CHECK constraints with scalar, deterministic expressions
CHECK Constraint with User-Defined Function (Unsupported)¶
When a CHECK constraint references a user-defined function, it is flagged with SSC-EWI-0116 because Snowflake does not support UDFs in CHECK constraints.
:force:
CREATEORREPLACETABLE Orders (
OrderID INTPRIMARYKEY,
Price DECIMAL(10,2)!!!RESOLVE EWI!!!/*** SSC-EWI-0116 - CHECK CONSTRAINT WITH user-defined function IS NOT SUPPORTED IN SNOWFLAKE ***/!!!CHECK(dbo.IsValidPrice(Price)=1))COMMENT='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}';
CHECK Constraint with Non-Deterministic Function (Unsupported)¶
Non-deterministic functions like NEWID() are flagged with SSC-EWI-0116.
:force:
CREATEORREPLACETABLE Sessions (
SessionID INTPRIMARYKEY,
Token NVARCHAR(100)!!!RESOLVE EWI!!!/*** SSC-EWI-0116 - CHECK CONSTRAINT WITH non-deterministic function IS NOT SUPPORTED IN SNOWFLAKE ***/!!!CHECK(Token <>CAST(NEWID()AS NVARCHAR(100))))COMMENT='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}';
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.
:force:
CREATEORREPLACETABLE TABLE1 (
COL2 INTNOTNULL,
COL2 INTNOTNULL,
COL1 VARIANTAS(COL3 * COL2)/*** SSC-FDM-TS0014 - COMPUTED COLUMN WAS TRANSFORMED TO ITS SNOWFLAKE EQUIVALENT, FUNCTIONAL EQUIVALENCE VERIFICATION PENDING. ***/)COMMENT='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}';
If the computed expression cannot transform, a warning is added, and a simple column definition with the expression return type will be used instead, like in the following example:
The expression CONVERT ([NUMERIC], ExpressionValue) is not supported yet by SnowConvert AI, so, after it is inspected, SnowConvert AI will determine that its type is XML, so the transformation will be
:force:
CREATEORREPLACETABLE TABLE1 (
Col1 TEXTAS(CAST(ExpressionValue ASVARIANT!!!RESOLVE EWI!!!/*** SSC-EWI-0036 - XML DATA TYPE CONVERTED TO VARIANT ***/!!!))/*** SSC-FDM-TS0014 - COMPUTED COLUMN WAS TRANSFORMED TO ITS SNOWFLAKE EQUIVALENT, FUNCTIONAL EQUIVALENCE VERIFICATION PENDING. ***/)COMMENT='{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}';
SnowConvert AI will run a process to determine the original expression type in SQL Server. 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.
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.
Azure Synapse Analytics presents an additional syntax for defining table options.
:force:<table_option>::={
CLUSTERED COLUMNSTORE INDEX-- default for Azure Synapse Analytics | CLUSTERED COLUMNSTORE INDEXORDER(column[,...n])| HEAP --default for Parallel Data Warehouse| CLUSTERED INDEX({ index_column_name [ASC|DESC]}[,...n ])-- default is ASC}{DISTRIBUTION=HASH( distribution_column_name )|DISTRIBUTION=HASH([distribution_column_name [,...n]])|DISTRIBUTION= ROUND_ROBIN -- default for Azure Synapse Analytics|DISTRIBUTION=REPLICATE-- default for Parallel Data Warehouse}|PARTITION( partition_column_name RANGE[LEFT|RIGHT]-- default is LEFT FORVALUES([ boundary_value [,...n]]))
Snowflake automatically handles table optimization through mechanisms like micro-partitioning. For this reason, an equivalent syntax for some of these table options does not exist in Snowflake. Therefore, it is not necessary to define some of Transact’s table options.
Table options that will be omitted:
CLUSTERED COLUMNSTORE INDEX (without column)
HEAP
DISTRIBUTION
PARTITION
CLUSTERED [ COLUMNSTORE ] INDEX with columns, will be transformed to Snowflake’s CLUSTER BY. A performance review PRF will be added as it is advised to check if defining a CLUSTER KEY is necessary.
TEXTIMAGE_ON [PRIMARY] is a way in Transact to handle the large information groups inside a table. In Snowflake it is not required to define these kinds of characteristics because Snowflake handles large data files or information in a different arrangement.