Sybase SQL Anywhere to MySQL Migration

SQLines tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from SAP SQL Anywhere, Sybase SQL Anywhere, Sybase Adaptive Server Anywhere (Sybase ASA) to MySQL.

Databases:

  • Sybase SQL Anywhere 17, 16, 12, 11, 10, 9 and 5
  • MySQL 9.x, 8.x, 6.x and 5.x

See also Sybase Adaptive Server Enterprise to MySQL Migration.

Migration Reference

SQL Language Elements

Converting SQL language elements and constructs:

Sybase SQL Anywhere MySQL
1 IF condition THEN exp ELSE exp2 ENDIF IF expression IF(condition, exp, exp2)

Data Types

Character data types:

Sybase SQL Anywhere MySQL
1 CHAR(n) Variable-length string, not padded, 1 ⇐ n ⇐ 32767 CHAR(n⇐255) TEXT
2 LONG VARCHAR Character data, ⇐ 2G LONGTEXT

Unicode data:

Sybase SQL Anywhere MySQL
1 LONG NVARCHAR Variable-length UTF-8 string, ⇐ 2G LONGTEXT
2 NCHAR(n) Fixed-length UTF-8 string, 1 ⇐ n ⇐ 32,767 NCHAR(n)
3 NVARCHAR(n) Variable-length UTF-8 string, 1 ⇐ n ⇐ 32767 NVARCHAR(n)

Numeric data types:

Sybase SQL Anywhere MySQL
1 BIGINT 64-bit integer BIGINT
2 DECIMAL(p,s) Fixed point number DECIMAL(p,s)
3 DOUBLE [PRECISION] Double-precision floating-point number DOUBLE [PRECISION]
4 INTEGER, INT 32-bit integer INTEGER, INT
5 NUMERIC(p,s) Fixed point number NUMERIC(p,s)
6 SMALLINT 16-bit integer SMALLINT

Date and time data types:

Sybase SQL Anywhere MySQL
1 DATE Date (year, month and day) DATE
2 TIME Time (hour, minute, second and microseconds fraction) TIME(6)
3 TIMESTAMP Date and time with fraction (microseconds) DATETIME(6)

Binary data:

Sybase SQL Anywhere MySQL
1 LONG BINARY Binary data, ⇐ 2G LONGBLOB

Built-in SQL Functions

Date and time functions:

Sybase ASA MySQL
1 CURRENT TIMESTAMP Get the current date and time CURRENT_TIMESTAMP(6)
CURRENT_TIMESTAMP

System functions:

Sybase ASA MySQL
1 CURRENT USER Get the authenticated user name CURRENT_USER
CURRENT_USER

CREATE FUNCTION Statement

Converting user-defined SQL functions:

Sybase SQL Anywhere MySQL
1 CREATE FUNCTION name CREATE FUNCTION name
2 (IN param type DEFAULT default, …) (param type, …) Default is not supported
3 RETURNS datatype(length) RETURNS datatype(length)

CREATE PROCEDURE Statement

Converting stored procedures:

Sybase SQL Anywhere MySQL
1 CREATE [OR REPLACE] PROCEDURE name CREATE PROCEDURE name
2 (IN | OUT | INOUT param type DEFAULT default, …) (IN | OUT | INOUT param type, …) Default is not supported

CREATE TABLE Statement

Converting table definitions:

Sybase SQL Anywhere MySQL
1 DEFAULT TIMESTAMP Auto-updated timestamp DEFAULT CURRENT_TIMESTAMP(6)
ON UPDATE CURRENT_TIMESTAMP(6)
2 DEFAULT LAST USER User modified row DEFAULT CURRENT_USER

Data type attributes:

Sybase SQL Anywhere MySQL
1 UNSIGNED integer_type Non-negative integer integer_type UNSIGNED
2 INLINE num Data type attribute Removed
3 PREFIX num Data type attribute Removed

Constraints:

Sybase SQL Anywhere MySQL
1 PRIMARY KEY(col [ASC | DESC], …) Primary key PRIMARY KEY(col [ASC | DESC], …)

Foreign keys:

Sybase SQL Anywhere MySQL
1 NOT NULL FOREIGN KEY NULLs are not allowed FOREIGN KEY NOT NULL clause commented
2 FOREIGN KEY (col ASC | DESC, …) Column ordering Not supported for foreign keys, removed