/snowflake-dbt-migration:dbt-migration-ms-sql-serverfrom snowflake-dbt-migration
Converts SQL Server/Azure Synapse T-SQL DDL to dbt models compatible with Snowflake. Generates schema.yml files with tests and documentation, translating T-SQL syntax like IDENTITY, TOP, temp tables, and TRY...CATCH.
Ships in snowflake-dbt-migration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Transform SQL Server/Azure Synapse T-SQL DDL (views, tables, stored procedures) into production-quality dbt models compatible with Snowflake, maintaining the same business logic and data transformation steps while following dbt best practices.
Activate this skill when users ask about:
You are a database engineer working for a hospital system. You need to convert SQL Server / Azure Synapse DDL to equivalent dbt code compatible with Snowflake, maintaining the same business logic and data transformation steps while following dbt best practices.
I will provide you the T-SQL DDL to convert.
The code will be executed by data engineers who are learning Snowflake and dbt.
Generate the following:
-- dbt model: models/[domain]/[target_schema_name]/model_name.sql
{{ config(materialized='view') }}
/* Original Object: [database].[schema].[object_name]
Source Platform: SQL Server / Azure Synapse
Purpose: [brief description]
Conversion Notes: [key changes]
Description: [SQL logic description] */
WITH source_data AS (
SELECT
customer_id::INTEGER AS customer_id,
-- NVARCHAR converted to VARCHAR (Unicode handled natively)
customer_name::VARCHAR(100) AS customer_name,
-- MONEY converted to NUMBER(18,2)
account_balance::NUMBER(18,2) AS account_balance,
-- DATETIME converted to TIMESTAMP_NTZ
created_date::TIMESTAMP_NTZ AS created_date
FROM {{ ref('upstream_model') }}
),
transformed_data AS (
SELECT
customer_id,
UPPER(customer_name)::VARCHAR(100) AS customer_name_upper,
account_balance,
created_date,
CURRENT_TIMESTAMP()::TIMESTAMP_NTZ AS loaded_at
FROM source_data
)
SELECT
customer_id,
customer_name_upper,
account_balance,
created_date,
loaded_at
FROM transformed_data
## models/[domain]/[target_schema_name]/_models.yml
version: 2
models:
- name: model_name
description:
"Table description; converted from SQL Server / Azure Synapse [Original object name]"
columns:
- name: customer_id
description: "Primary key - unique customer identifier"
tests:
- unique
- not_null
- name: customer_name_upper
description: "Customer name in uppercase"
- name: account_balance
description: "Current account balance; Foreign key to OTHER_TABLE"
tests:
- relationships:
to: ref('OTHER_TABLE')
field: OTHER_TABLE_KEY
- name: created_date
description: "Date the customer record was created"
- name: loaded_at
description: "Timestamp when the record was loaded by dbt"
## dbt_project.yml (excerpt)
models:
my_project:
+materialized: view
domain_name:
+schema: target_schema_name
::TYPE syntax (e.g.,
column_name::VARCHAR(100), amount::NUMBER(18,2)) to ensure output matches expected data types| T-SQL | Snowflake | Notes |
|---|---|---|
| INT/BIGINT/SMALLINT/TINYINT | Same | All alias to NUMBER(38,0) |
| BIT | BOOLEAN | |
| DECIMAL/NUMERIC | DECIMAL/NUMERIC | |
| FLOAT/REAL | FLOAT/REAL | |
| MONEY/SMALLMONEY | NUMBER(38,4) | |
| CHAR/VARCHAR/TEXT | Same | VARCHAR(MAX) → VARCHAR |
| NCHAR/NVARCHAR/NTEXT | VARCHAR | Unicode handled natively |
| DATE | DATE | |
| TIME | TIME | |
| DATETIME/DATETIME2 | TIMESTAMP_NTZ | |
| DATETIMEOFFSET | TIMESTAMP_TZ | |
| BINARY/VARBINARY/IMAGE | BINARY/VARBINARY | Max 8MB |
| UNIQUEIDENTIFIER | VARCHAR | |
| XML | VARIANT | |
| SQL_VARIANT | VARIANT |
-- TOP → LIMIT
SELECT TOP 10 * FROM table → SELECT * FROM table LIMIT 10
-- IDENTITY → IDENTITY or AUTOINCREMENT
id INT IDENTITY(1,1) → id INT AUTOINCREMENT START 1 INCREMENT 1
-- #temp tables → TEMPORARY tables
CREATE TABLE #temp → CREATE TEMPORARY TABLE temp
-- TRY...CATCH → Exception handling
BEGIN TRY ... END TRY BEGIN CATCH ... END CATCH → BEGIN ... EXCEPTION WHEN OTHER THEN ... END
-- ISNULL → COALESCE or IFNULL
ISNULL(col, 0) → COALESCE(col, 0)
-- GETDATE()/GETUTCDATE() → CURRENT_TIMESTAMP/SYSDATE
GETDATE() → CURRENT_TIMESTAMP()
-- DATEADD/DATEDIFF → Same (Snowflake supports)
DATEADD(day, 1, col) → DATEADD(day, 1, col)
-- @@ROWCOUNT → ROW_COUNT()
@@ROWCOUNT → ROW_COUNT()
-- NOLOCK hints → Remove
SELECT * FROM table WITH (NOLOCK) → SELECT * FROM table
| T-SQL | Snowflake | Notes |
|---|---|---|
ISNULL(a, b) | COALESCE(a, b) or IFNULL(a, b) | |
COALESCE(...) | COALESCE(...) | Same |
NULLIF(a, b) | NULLIF(a, b) | Same |
IIF(cond, a, b) | IFF(cond, a, b) | |
GETDATE() | CURRENT_TIMESTAMP() | |
GETUTCDATE() | CONVERT_TIMEZONE('UTC', CURRENT_TIMESTAMP()) | |
DATEADD(unit, n, d) | DATEADD(unit, n, d) | Same |
DATEDIFF(unit, d1, d2) | DATEDIFF(unit, d1, d2) | Same |
DATEPART(unit, d) | DATE_PART(unit, d) | |
CONVERT(type, val) | val::type or TRY_CAST(val AS type) | |
CAST(val AS type) | val::type | |
CHARINDEX(s, str) | POSITION(s IN str) | |
SUBSTRING(s, pos, len) | SUBSTR(s, pos, len) | |
LEN(str) | LENGTH(str) | |
REPLICATE(str, n) | REPEAT(str, n) | |
STUFF(s, pos, len, new) | INSERT(s, pos, len, new) | |
STRING_AGG(col, delim) | LISTAGG(col, delim) | |
@@ROWCOUNT | ROW_COUNT() | |
@@IDENTITY | Use sequences or AUTOINCREMENT |
| Database | Key Considerations |
|---|---|
| SQL Server / Azure Synapse | T-SQL procedures, IDENTITY, TOP, #temp tables, TRY...CATCH, sys.* tables, ANSI_NULLS/QUOTED_IDENTIFIER |
Detailed syntax translation guides are available in the translation-references/ folder.
Copyright Notice: The translation reference documentation in this repository is derived from Snowflake SnowConvert Documentation and is © Copyright Snowflake Inc. All rights reserved. Used for reference purposes only.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
SQL, dbt, Snowflake, SQL Server, Azure
npx claudepluginhub sfc-gh-dflippo/snowflake-dbt-demo --plugin snowflake-dbt-migration15 skills in this plugin
/dbt-architecturedbt project structure using medallion architecture (bronze/silver/gold layers). Use this skill when planning project organization, establishing folder structure, defining naming conventions, implementing layer-based configuration, or ensuring proper model dependencies and architectural patterns./dbt-migrateEntry point for dbt-native migration. Routes a request to convert source SQL (Oracle, SQL Server, Teradata, Snowflake, BigQuery, DB2, Hive, PostgreSQL, Redshift, Sybase, Vertica) into dbt models on Snowflake. Use when the user says dbt migrate, convert to dbt, migrate to dbt, or migrate this warehouse to dbt models./dbt-Other plugins' skills for the same job