Microsoft SQL Server to IBM DB2 Migration

SQLines tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from Microsoft SQL Server (MSSQL, MS SQL), Azure SQL Database, Azure Synapse to IBM DB2:

  • SQLines Data - Data transfer, schema migration and validation tool
  • SQLines SQL Converter - SQL scripts conversion tool

Databases:

  • Microsoft SQL Server 2022, 2019, 2017, 2016, 2014, 2012, 2008, 2005 and 2000
  • IBM DB2 for LUW, z/OS and OS/400 11.x, 10.x, 9.x, 8.x and 7.x

Migration Reference

Data Types

Converting data types:

SQL Server IBM DB2
CHAR Fixed-length character string CHAR
INT, INTEGER 32-bit integer INT, INTEGER
SMALLINT 16-bit integer SMALLINT
VARCHAR Variable-length character string VARCHAR

CREATE FUNCTION Statement

Converting Transact-SQL user-defined functions:

SQL Server IBM DB2
1 CREATE FUNCTION | ALTER FUNCTION name CREATE OR REPLACE FUNCTION name
2 @param [AS] datatype = default p_param datatype DEFAULT default
3 RETURNS datatype(len) RETURNS datatype(len)
4 Optional AS before the function body Removed
5 Optional statement delimiter ; is added after each statement

For more information, see Conversion of Transact-SQL Statements.

CREATE PROCEDURE Statement

Converting Transact-SQL stored procedures:

SQL Server IBM DB2
1 CREATE PROCEDURE name CREATE OR REPLACE PROCEDURE name
2 @param [AS] datatype = default p_param datatype DEFAULT default
3 Optional AS before the procedure body Removed
4 Optional statement delimiter ; is added after each statement

For more information, see Conversion of Transact-SQL Statements.

Transact-SQL Statements

Variable declaration and assignment:

SQL Server IBM DB2
1 DECLARE @v1 type1, @v2 type2, … DECLARE v1 type1; DECLARE v2 type2, DECLARE …