Convert Teradata BTEQ and SQL to Snowflake

BTEQ scripts, stored procedures, and Teradata SQL parsed structurally. Converted to Snowflake SQL with native QUALIFY support. COLLECT STATISTICS, MERGE INTO, and PRIMARY INDEX logic fully translated.

Upload a BTEQ script, get converted code →
Why Snowflake

Teradata's appliance model doesn't scale elastically

QUALIFY preserved natively

Snowflake supports QUALIFY as a first-class SQL clause. Teradata's QUALIFY ROW_NUMBER(), RANK(), and DENSE_RANK() patterns transfer directly—no subquery wrapping, no rewrite. The analytical intent stays readable and performant.

BTEQ becomes SnowSQL and stored procedures

BTEQ's .LOGON, .IF/.THEN, .GOTO control flow and embedded SQL are parsed and converted to Snowflake stored procedures and SnowSQL scripts. .LABEL and .QUIT logic becomes structured exception handling with Snowflake Scripting.

FastLoad becomes Snowpipe and COPY INTO

Teradata's proprietary bulk-loading utilities—FastLoad, MultiLoad, FastExport, TPump—are replaced by Snowflake's COPY INTO for batch loads and Snowpipe for continuous ingestion. No proprietary channel drivers or appliance firmware required.

Parser output

BTEQ with COLLECT STATISTICS and QUALIFY to Snowflake

A BTEQ script using COLLECT STATISTICS and QUALIFY for deduplication—converted to Snowflake SQL where QUALIFY is preserved natively and statistics are managed automatically.

Teradata BTEQ
.LOGON tdserver/dbc,dbc;

COLLECT STATISTICS ON customer_orders
  COLUMN (customer_id);

CREATE VOLATILE TABLE latest_orders AS (
  SELECT customer_id, order_date, amount,
         order_status, region
  FROM customer_orders
  WHERE order_date >= DATE - 365
  QUALIFY ROW_NUMBER() OVER (
    PARTITION BY customer_id
    ORDER BY order_date DESC
  ) = 1
) WITH DATA ON COMMIT PRESERVE ROWS;

SELECT region,
       COUNT(*) AS customer_count,
       SUM(amount) AS total_revenue,
       AVG(amount) AS avg_order_value
FROM latest_orders
GROUP BY region
ORDER BY total_revenue DESC;

.LOGOFF;
.QUIT;
MigryX
converts
Snowflake SQL
-- BTEQ → Snowflake SQL
-- COLLECT STATISTICS: Snowflake manages
-- statistics automatically (no action needed)

CREATE TEMPORARY TABLE latest_orders AS
  SELECT customer_id, order_date, amount,
         order_status, region
  FROM customer_orders
  WHERE order_date >= DATEADD(DAY, -365,
                               CURRENT_DATE())
  QUALIFY ROW_NUMBER() OVER (
    PARTITION BY customer_id
    ORDER BY order_date DESC
  ) = 1;

SELECT region,
       COUNT(*) AS customer_count,
       SUM(amount) AS total_revenue,
       AVG(amount) AS avg_order_value
FROM latest_orders
GROUP BY region
ORDER BY total_revenue DESC;

BTEQ control flow removed. QUALIFY preserved natively in Snowflake. VOLATILE TABLE becomes TEMPORARY TABLE. DATE arithmetic mapped to DATEADD. COLLECT STATISTICS removed—Snowflake manages optimizer statistics automatically.

Coverage

Teradata to Snowflake — artifact mapping

Teradata Component Snowflake Equivalent Notes
BTEQ scriptSnowSQL / stored procedure.LOGON/.LOGOFF removed, SQL extracted and converted
QUALIFY clauseQUALIFY (native)Snowflake supports QUALIFY natively—no rewrite
COLLECT STATISTICSAutomatic (not needed)Snowflake manages optimizer statistics internally
PRIMARY INDEXClustering keyData co-location via CLUSTER BY for large tables
FastLoadCOPY INTO / SnowpipeBatch or continuous ingestion from stage
MultiLoadMERGE INTOUpsert and conditional update patterns
Stored ProcedureSnowflake ScriptingJavaScript or SQL-based stored procedures
MacroStored procedure + parametersReusable parameterized SQL blocks
SET tableSELECT DISTINCT / MERGEUnique-row enforcement via deduplication
MERGE INTOMERGE INTO (native)WHEN MATCHED / NOT MATCHED fully preserved
Temporal tableTime Travel + CHANGESSnowflake Time Travel for historical queries
TPumpSnowpipe StreamingNear-real-time continuous ingestion
Validation

Every conversion validated to row-level parity

Data Matching compares Teradata output against Snowflake output—row by row, column by column. In the case study below, all BTEQ pipelines were validated with full production backtesting across 4,200 scripts.

See how Data Matching works →
4,200
BTEQ scripts modernized
4X
Performance gain
$7.8M
Savings over 3 years
1,500
QUALIFY preserved natively

Financial Institution: Teradata to Snowflake in 16 Months

4,200 BTEQ scripts converted to Snowflake SQL. 1,500 QUALIFY clauses preserved natively without subquery wrapping. FastLoad and MultiLoad jobs replaced with COPY INTO and Snowpipe. PRIMARY INDEX strategies mapped to clustering keys. Teradata appliance decommissioned within 120 days.

Read the full case study →

See it on your own Teradata scripts

Upload a BTEQ script or Teradata SQL file. Get parsed lineage, Snowflake SQL code, and a validation report.

Book a Live Demo → hello@migryx.com