Default values emulation

In Synapse Analytics, columns can have default values defined in the table schema, allowing INSERT operations to omit those columns and still generate meaningful values automatically. Common defaults include timestamps, status flags, or unique identifiers.

However, Microsoft Fabric Warehouse does not support column-level default constraints — any default behavior must be handled explicitly in application logic.

SQL Tran addresses this by removing unsupported default definitions from table schemas and rewriting INSERT statements to explicitly supply the appropriate default values.

This ensures that data insertion behavior remains consistent without requiring manual code refactoring, preserving the original logic even when migrating large and complex schemas.

(For more information, see the following emulation reference page: Default values)


Code example

Synapse Analytics:

CREATE PROCEDURE [dbo].[TestDefaultValues]
AS
BEGIN
	CREATE TABLE ExampleTable (
		ID uniqueidentifier DEFAULT NEWID() ROWGUIDCOL,
		Name varchar(50) NOT NULL,
		Status varchar(20) DEFAULT 'Active', 
		CreatedAt DATETIME2(6) DEFAULT GETDATE(),
	);

	INSERT INTO ExampleTable (ID, Name, Status, CreatedAt)
	VALUES (NEWID(), 'Alice', 'Inactive', SYSUTCDATETIME());

	INSERT INTO ExampleTable (Name)
	VALUES ('Bob');

	INSERT INTO ExampleTable (ID, Name, Status, CreatedAt)
	VALUES (DEFAULT, 'Charlie', DEFAULT, DEFAULT);

	INSERT INTO ExampleTable DEFAULT VALUES;
END;

Fabric Warehouse (generated by SQL Tran):

CREATE PROCEDURE [dbo].[TestDefaultValues]
AS
BEGIN
	CREATE TABLE ExampleTable (
		ID uniqueidentifier /* SQLTRAN FIX: DEFAULT NEWID() */ /* SQLTRAN FIX: ROWGUIDCOL */,
		Name varchar(50) NOT NULL,
		Status varchar(20) /* SQLTRAN FIX: DEFAULT 'Active' */, 
		CreatedAt DATETIME2(6) /* SQLTRAN FIX: DATETIME2(6) */ /* SQLTRAN FIX: DEFAULT GETDATE() */,
	);

	INSERT INTO ExampleTable (ID, Name, Status, CreatedAt)
	VALUES (NEWID(), 'Alice', 'Inactive', SYSUTCDATETIME());

	
INSERT
	INTO ExampleTable ([ID], Name, [Status], [CreatedAt])
	VALUES (NEWID(), 'Bob', 'Active', GETDATE());
 /* SQLTRAN FIX: INSERT INTO ExampleTable (Name)
	VALUES ('Bob'); */

	INSERT INTO ExampleTable (ID, Name, Status, CreatedAt)
	VALUES (DEFAULT, 'Charlie', DEFAULT, DEFAULT);

	
INSERT
	INTO ExampleTable ([ID], [Status], [CreatedAt])
	DEFAULT VALUES;
 /* SQLTRAN FIX: INSERT INTO ExampleTable DEFAULT VALUES; */
END;

Training video example

In the example shown, a procedure inserts a row into the Emulations.NameStatuses table. This table defines a Status column with a default value.

Default value in table definition

In the original source SQL, the INSERT INTO ... VALUES ... statement omits the Status column, relying on the database default behavior — a strategy that would fail in Fabric.

SQL Tran emulates this default behavior by rewriting the INSERT statement to explicitly provide the default value in the target SQL.

In this case, both identity column emulation and default value emulation are applied to ensure complete compatibility.

This automation eliminates the need for time-consuming manual corrections and preserves expected data behavior during migration.

Default value emulation in translated SQL

Last updated