Skip to main content
Version: 1.0

SQL Server Examples

Comprehensive examples for transferring data from and to SQL Server databases.

MSSQL to MSSQL - Single-threaded Transfer​

Simple transfer without parallelization for smaller datasets.

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_copy" `
--query "select * from orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders" `
--parallelmethod "None" `
--loadmode Truncate

MSSQL to MSSQL - Parallel Transfer with Random Method​

Transfer using Random distribution based on a key column.

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "Random" `
--distributekeycolumn "o_orderkey" `
--degree 12 `
--loadmode Truncate

MSSQL to MSSQL - Parallel Transfer with RangeId Method​

Transfer using RangeId distribution for evenly distributed integer keys.

Using table name:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "RangeId" `
--distributekeycolumn "o_orderkey" `
--degree 12 `
--loadmode Truncate

Using query with filter:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--query "select * from dbo.orders WHERE o_orderdate between '19950101' and '19951231'" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_1995" `
--parallelmethod "RangeId" `
--distributekeycolumn "o_orderkey" `
--degree 12 `
--loadmode Append

MSSQL to MSSQL - Parallel Transfer with Ntile Method​

Transfer using Ntile distribution for evenly distributed chunks.

Full table transfer:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "Ntile" `
--distributekeycolumn "o_orderkey" `
--degree 12 `
--loadmode Truncate

Filtered transfer with date column:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--query "select * from dbo.orders WHERE o_orderdate between '19950101' and '19951231'" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_1995" `
--parallelmethod "Ntile" `
--distributekeycolumn "o_orderdate" `
--degree 12 `
--loadmode Append

MSSQL to MSSQL - Parallel Transfer with DataDriven Method​

Transfer using DataDriven distribution based on distinct values of a column or partition function.

Using partition function:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch10_collation_bin2" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch10_collation_bin2_copy" `
--query "select * from orders_part" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders" `
--parallelmethod "DataDriven" `
--distributekeycolumn "`$PARTITION.PF_DATE(o_orderdate)" `
--degree 10 `
--loadmode "Truncate"

Using year function:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--query "select * from dbo.orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "DataDriven" `
--distributekeycolumn "YEAR(o_orderdate)" `
--degree 7 `
--loadmode Append

MSSQL to MSSQL - Using the Physical Method​

Transfer using physical location (should only be used on readonly/snapshot databases).

warning

On SQL Server, the Physical method (Physloc) should only be used on readonly tables, databases, or snapshots, as it relies on physical page locations that may change during writes.

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcetrusted `
--sourcedatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders_15M" `
--targetconnectiontype "msbulk" `
--targetserver "localhost,11433" `
--targettrusted `
--targetdatabase "tpch_test" `
--targetschema "dbo" `
--targettable "orders_ccsi" `
--loadmode "Truncate" `
--batchsize 120000 `
--parallelmethod "Physical" `
--degree 10 `
--mapmethod "Name"

MSSQL to PostgreSQL​

Transfer data from SQL Server to PostgreSQL.

Without parallelization:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "pgcopy" `
--targetserver "localhost:5432" `
--targetdatabase "tpch_import" `
--query "select * from dbo.orders" `
--targetuser "FastUser" `
--targetpassword "FastPassword" `
--targetschema "tpch_10" `
--targettable "orders" `
--parallelmethod "None" `
--loadmode "Truncate"

With Random method:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "pgcopy" `
--targetserver "localhost:5432" `
--targetdatabase "tpch_import" `
--query "select * from dbo.orders" `
--targetuser "FastUser" `
--targetpassword "FastPassword" `
--targetschema "tpch_10" `
--targettable "orders" `
--parallelmethod "Random" `
--distributekeycolumn "o_orderkey" `
--degree 10 `
--loadmode "Truncate"

MSSQL to MySQL​

Transfer data from SQL Server to MySQL.

Without parallelization:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "mysqlbulk" `
--targetserver "localhost" `
--targetdatabase "tpch" `
--query "select * from dbo.orders" `
--targetuser "FastUser" `
--targetpassword "FastPassword" `
--targetschema "tpch" `
--targettable "orders" `
--parallelmethod "None" `
--loadmode "Truncate"

With Random method:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "mysqlbulk" `
--targetserver "localhost" `
--targetdatabase "tpch" `
--query "select * from dbo.orders" `
--targetuser "FastUser" `
--targetpassword "FastPassword" `
--targetschema "tpch" `
--targettable "orders" `
--parallelmethod "Random" `
--distributekeycolumn "o_orderkey" `
--degree 6 `
--loadmode "Truncate"

With DataDriven method on partitioned table:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "mysqlbulk" `
--targetserver "localhost" `
--targetdatabase "tpch" `
--query "select * from dbo.orders_part" `
--targetuser "FastUser" `
--targetpassword "FastPassword" `
--targetschema "tpch" `
--targettable "orders" `
--parallelmethod "DataDriven" `
--distributekeycolumn "`$PARTITION.PF_DATE(o_orderdate)" `
--degree 7 `
--loadmode "Truncate"

MSSQL to DuckDB​

Transfer data from SQL Server to DuckDB.

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch10_collation_bin2" `
--sourceschema "dbo" `
--sourcetable "orders_1M" `
--sourcetrusted `
--targetconnectiontype "duckdb" `
--targetdatabase "tpch10_insert" `
--targetschema "tpch10" `
--targettable "orders" `
--parallelmethod "None" `
--loadmode "Truncate" `
--targetserver "D:\OpenData\TPCH\data\10\duckdb\tpch10_insert.duckdb"

Using ODBC Connection​

Transfer using ODBC DSN for connection.

Single-threaded:

.\FastTransfer.exe `
--sourceconnectiontype "odbc" `
--sourcedsn "DSNMsSQLTPCH" `
--sourcedatabase "tpch_test" `
--query "select top 1000 * from dbo.orders" `
--sourceuser "FastUser" `
--sourcepassword "FastPassword" `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders" `
--parallelmethod "None" `
--loadmode "Truncate"

Dynamic Degree​

Use negative degree values to automatically determine parallelism based on CPU cores.

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "Random" `
--distributekeycolumn "o_orderkey" `
--degree -4 `
--loadmode "Truncate"
info

A negative degree value (e.g., -4) divides the number of CPU cores by its absolute value to determine the actual degree of parallelism. With 16 cores, -4 results in 4 parallel threads.

Load Modes​

FastTransfer supports different load modes for the target table:

  • Truncate: Truncates the target table before loading
  • Append: Appends data to existing table (default)

Example with Append mode:

.\FastTransfer.exe `
--sourceconnectiontype "mssql" `
--sourceserver "localhost" `
--sourcedatabase "tpch_test" `
--sourcetrusted `
--targetconnectiontype "msbulk" `
--targetserver "localhost" `
--targetdatabase "tpch_test" `
--sourceschema "dbo" `
--sourcetable "orders" `
--targettrusted `
--targetschema "dbo" `
--targettable "orders_copy" `
--parallelmethod "None" `
--loadmode "Append"
tip

Build your command with the Wizard

Copyright © 2026 Architecture & Performance.