Sybase ASE to MySQL Migration

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

Databases:

  • Sybase Adaptive Server Enterprise 16.x, 15.x, 12.x and 11.x
  • MySQL 9.x, 8.x, 6.x, 5.x

Migration Reference

SQL Language Elements

Converting SQL language elements:

Sybase ASE MySQL
1 Single '' and double "" quotes Identifiers and strings Single '' and double "" quotes

Data Types

Character data types:

Sybase ASE MySQL
1 CHAR Fixed-length character string CHAR
2 VARCHAR Variable-length character string VARCHAR

Numeric data types:

Sybase ASE MySQL
1 INT, INTEGER 32-bit integer INT, INTEGER
2 NUMERIC, NUMERIC(p), NUMERIC(p, 0) Integer, 1 <= p <= 38, default is 18 INTEGER p < 9
BIGINT p >= 9
3 SMALLINT 16-bit integer SMALLINT

Built-in SQL Functions

String functions:

Sybase ASE MySQL
1 ASCII(string) Get ASCII value of left-most character ASCII(string)
2 CHAR(code) Get character from its ASCII code CHAR(code)
3 CHAR_LENGTH(string) String length in characters CHAR_LENGTH(string)
4 CHARINDEX(substr, string [,pos]) Get position of substr in string LOCATE(substr, string [,pos])
5 CONVERT(VARCHAR(len), string) Get a substring of string CAST(string AS CHAR(len))
6 DATALENGTH(string) String length in bytes LENGTH(string)
7 LEFT(string, num) Return num leftmost characters LEFT(string, num)
8 LEN(string) String length in characters CHAR_LENGTH(string)
9 LOWER(string) Convert string to lowercase LOWER(string)
10 LTRIM(string) Remove the leading blanks LTRIM(string)
11 PATINDEX(pattern, string) Get position of pattern in string UDF required
12 REPLICATE(string, num) Replicate string num times REPEAT(string, num)
13 REVERSE(string) Reverse string REVERSE(string)
14 RIGHT(string, num) Return num rightmost characters RIGHT(string, num)
15 RTRIM(string) Remove the trailing blanks RTRIM(string)
16 SPACE(num) Return string of num spaces SPACE(num)
17 STR_REPLACE(string, from, to) Replace substring with specified value REPLACE(string, from, to)
18 STUFF(str, start, len, val) Replace substring with val INSERT(str, start, len, val)
19 SUBSTRING(string, start, len) Get substring of string SUBSTRING(string, start, len)
20 UPPER(string) Convert string to uppercase UPPER(string)

CREATE TABLE Statement

Converting CREATE TABLE statement keywords and clauses:

Sybase ASE MySQL
1 IDENTITY(start, increment) Identity column AUTO_INCREMENT Increment is always 1
2 IDENTITY can be defined on DECIMAL/NUMERIC columns Integer columns must be used

Transact-SQL Statements

Converting Transact-SQL statements:

Sybase ASE MySQL
1 PRINT 'text' Print message SELECT 'text' AS ''
\! echo 'text'; In SQL script
Commented inside a function

SQL Statements

Converting SQL statements:

Sybase ASE MySQL
1 USE dbname Change the database USE dbname

System Procedures

Converting system procedures:

Sybase ASE MySQL
1 sp_addgroup name Create a group CREATE ROLE name
2 sp_adduser name, name_in_db, group_name Create user CREATE USER name IDENTIFIED BY pwd;
GRANT group_name TO name