SAP Sybase Advantage Database Server to SQL Server Migration

SQLines open source tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from SAP Sybase Advantage Database Server (Sybase ADS) to Microsoft SQL Server.

  • SAP Sybase Advantage Database Server 12.x, 11.x, 10.x and 9.x
  • Microsoft SQL Server 2016, 2014, 2012, 2008, 2005 and 2000

Migration Reference

Language Elements

SQL language elements:

Sybase ADS SQL Server
1 // text Single-line comment -- text

Data Types

Numeric data types:

Sybase ADS SQL Server
1 CurDouble 8-byte floating-point FLOAT
2 Short 16-bit integer, -32,767 to 32,767 SMALLINT

Character data types:

Sybase ADS SQL Server
1 NMemo Variable-length UTF-16 string, up to 4 GB NVARCHAR(max)
2 Memo Variable-length string, up to 4 GB VARCHAR(max)

Other data types:

Sybase ADS SQL Server
1 AutoInc Auto-increment INT IDENTITY
2 Logical Boolean 1, 0, 'T', 'F', 'Y', 'N' CHAR(1)

Built-in SQL Functions

Datetime functions:

Sybase ADS SQL Server
1 CURRENT_DATE() Get the current date (year, month, day) CONVERT(DATE, GETDATE())
2 CURRENT_TIMESTAMP() Get the current datetime CURRENT_TIMESTAMP

Data type conversion functions:

Sybase ADS SQL Server
1 CONVERT(expr, SQL_CHAR) Convert to string CONVERT(VARCHAR, expr) CAST(expr AS VARCHAR)

CASE and NULL functions:

Sybase ADS SQL Server
1 IFNULL(expr, expr2) Return first non-NULL expression ISNULL(expr, expr2)
2 IIF(bool_expr, true_expr, false_expr) IF -THEN-ELSE expression IIF(bool_expr, true_expr, false_expr)

SELECT Statement

Queries:

Sybase ADS SQL Server
1 SELECT expr FROM system.iota Calculate expression SELECT expr
2 SELECT udf(p1, …) FROM System.iota Execute user function (UDF) SELECT dbo.udf(p1, …) EXEC dbo.udf p1, …

CREATE PROCEDURE Statement

Converting stored procedures:

Sybase ADS SQL Server
1 CREATE PROCEDURE name CREATE PROCEDURE name
2 param datatype(length) [OUTPUT] @param datatype(length) [= default] [OUTPUT]
3 No AS keyword AS required
4 SELECT param FROM __input Access input param @param

For more information, see Conversion of Procedural SQL Statements.

Procedural Language

Cursors:

Sybase ADS SQL Server
1 DECLARE cur CURSOR AS SELECT … Cursor declaration DECLARE cur CURSOR FOR SELECT …
2 OPEN cur Open cursor OPEN cur
3 WHILE FETCH cur DO stmts; END WHILE Fetch cursor in loop FETCH cur INTO …
WHILE @@FETCH_STATUS=0
BEGIN stmts; FETCH cur INTO … END

Flow-of-control statements:

Sybase ADS SQL Server
1 IF condition THEN … [ELSEIF/ELSE …] ENDIF IF statement IF condition BEGIN … END [ELSE [IF] BEGIN … END]

Executing stored procedures:

Sybase ADS SQL Server
1 EXECUTE PROCEDURE name (param, …) Procedure with parameters EXECUTE name param, …

System Tables

System tables:

Sybase ADS SQL Server
1 System.iota Single row/column table (“dual” table) Not required, SELECT can be without FROM