Migrating Data from SQL Server¶
This page covers SQL Server-specific setup for Data migration. For workflow and Worker field definitions, see Data migration configuration reference.
Prerequisites¶
- Microsoft ODBC Driver for SQL Server on each Worker host (the Worker auto-detects a suitable driver when none is set). Pin a driver with
odbc_driverin TOML. bcputility (for faster extraction on custom Worker hosts): On Snowpark Container Services Workers, the unified image installsbcpautomatically (viamssql-tools18) and setsuse_bcp = trueby default. On custom Worker hosts, install the SQL Serverbcpbulk copy utility and setuse_bcp = truein Worker TOML. See Download and install the bcp utility and bcp utility.- Windows integrated security (optional): set
use_windows_auth = trueon Windows Workers.
Connectivity and extraction¶
SQL Server uses the default regular extraction strategy (not a separate BCP strategy). By default the Worker pulls partitioned result sets over ODBC and writes Parquet to the internal migration stage. Set use_bcp = true in Worker TOML to use the SQL Server bcp bulk copy utility instead: bcp exports CSV locally on the Worker, then the Worker PUTs those files to the same internal stage. BCP is typically faster than ODBC for large tables and does not require an external stage.
On SPCS Workers, use_bcp = true is the default and bcp is installed at container start. On custom Worker hosts, install bcp yourself and opt in with use_bcp = true; when bcp is unavailable, the Worker falls back to ODBC.
SQL authentication¶
Explicit driver and encryption¶
Optional encrypt and trust_server_certificate follow ODBC Driver 17 vs 18 defaults. ODBC Driver 18 enables encryption by default.
Workflow example:
Tune columnNamesToPartitionBy and partitionSize for large tables.
Data type mappings¶
| SQL Server type | Snowflake target type | Supported for migration | Notes |
|---|---|---|---|
| BIT, TINYINT, SMALLINT, INT, BIGINT | NUMBER | Yes | |
| DECIMAL(p,s), NUMERIC(p,s) | NUMBER | Yes | Precision/scale expanded: NUMBER(p+2, s+4) |
| MONEY, SMALLMONEY | NUMBER | Yes | |
| FLOAT, REAL | FLOAT | Yes | |
| DATE | DATE | Yes | |
| TIME(n) | TIME | Yes | |
| DATETIME, DATETIME2(n), SMALLDATETIME | TIMESTAMP_NTZ | Yes | |
| DATETIMEOFFSET(n) | TIMESTAMP_TZ | Yes | |
| CHAR(n), VARCHAR(n), NCHAR(n), NVARCHAR(n) | VARCHAR | Yes | |
| BINARY(n), VARBINARY(n) | BINARY | Yes | |
| UNIQUEIDENTIFIER | VARCHAR | Yes | Stored as an uppercase UUID string |
| SYSNAME | VARCHAR | Yes | |
| TEXT, NTEXT | VARCHAR | Yes | |
| IMAGE | BINARY | Yes | |
| XML, SQL_VARIANT | VARIANT | Yes | |
| HIERARCHYID | VARCHAR | Yes | Stored as its hierarchy path string |
| ROWVERSION, TIMESTAMP | BINARY | Yes | SQL Server TIMESTAMP is a synonym for ROWVERSION, not a datetime |
| GEOGRAPHY, GEOMETRY | GEOGRAPHY | Yes |
Platform-specific considerations¶
-
BCP for throughput: On SPCS Workers, BCP is enabled by default. On custom Worker hosts, set
use_bcp = truewhenbcpis installed. BCP applies to migration only; validation always reads the source over ODBC.Prompt:
-
BCP caveats: BCP exports a NULL
DATETIMEas the Unix epoch (1970-01-01 00:00:00) because BCP has no NULL sentinel for date types. ODBC returns a proper NULL instead. BCP also preserves trailing spaces onCHAR(n)columns, while ODBC strips them. -
Partitioning: Tune
columnNamesToPartitionByandpartitionSizefor large or uneven tables.Prompt:
-
Encryption: Set
encryptandtrust_server_certificateexplicitly in lab or hardened environments. -
Anti-locking: Hints are off by default. On busy source tables, set
queryModifiers.objectModifierto" WITH (NOLOCK)"to avoid blocking on source locks, at the cost of dirty reads. See Anti-locking and query modifiers.