SQLines tools can help you transfer data, convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from Informix to Microsoft SQL Server (MSSQL), SQL Azure, Synapse and Fabric.
Databases:
Converting SQL language elements and constructs:
Informix | SQL Server | |||
1 | Single '' and double "" quotes | Identifiers and literals | Single '' and double "" quotes | |
2 | { comment } | /* comment */ | ||
3 | string[start, end] | Substring operator [] | SUBSTRING(string, start, end - start + 1) | |
string[start] | SUBSTRING(string, start, 1) | |||
4 | DBINFO('sqlca.sqlerrd2') | Get the number of affected rows | @@ROWCOUNT |
Character data types:
Numeric data types:
Informix | SQL Server | ||
1 | BIGINT | 64-bit integer | BIGINT |
2 | BIGSERIAL(s) | Auto-increment 64-bit integer | BIGINT |
3 | DECIMAL(p,s) | Fixed-point number | DECIMAL(p,s) |
4 | DOUBLE PRECISION | Synonym for FLOAT | FLOAT |
5 | FLOAT | Double-precision floating-point number | FLOAT |
6 | INTEGER, INT | 32-bit integer | INTEGER, INT |
7 | INT8 | 64-bit integer | BIGINT |
8 | MONEY(p,s) | Currency amount | MONEY |
9 | NUMERIC(p,s) | Fixed-point number | NUMERIC(p,s) |
10 | REAL | Synonym for SMALLFLOAT | REAL |
11 | SMALLFLOAT | Single-precision floating-point number | REAL |
12 | SMALLINT | 16-bit integer | SMALLINT |
13 | SERIAL(s) | Auto-increment 32-bit integer | INT |
14 | SERIAL8(s) | Auto-increment 64-bit integer | BIGINT |
Other data types:
Data type attributes and options:
Informix | SQL Server | |
1 | column BYTE IN TABLE | column VARBINARY(max) |
2 | column BYTE IN lob_space | column VARBINARY(max) |
3 | column TEXT IN TABLE | column VARCHAR(max) |
4 | column TEXT IN lob_space | column VARCHAR(max) |
Converting date and time functions:
Informix | SQL Server | ||
1 | CURRENT | Get the current date and time | GETDATE() |
2 | DAY(datetime) | Get the day of datetime | DAY(datetime) |
3 | MONTH(datetime) | Get the month (1-12) of datetime | MONTH(datetime) |
4 | TODAY | Get the current date (year, month and day) | CONVERT(DATE, GETDATE()) |
Converting other functions:
Informix | SQL Server | |||
1 | DBINFO('sqlca.sqlerrd2') | Get the number of affected rows | @@ROWCOUNT | |
2 | DECODE(exp, when, then, …, else) | Evaluate conditions | CASE exp WHEN when THEN then … ELSE else END |
|
3 | LEN(string) | Get string length | LEN(string) | |
LENGTH(string) | ||||
4 | TRIM(string) | Remove leading and trailing spaces | RTRIM(LTRIM(string)) |
Converting CREATE TABLE statement keywords and clauses:
Converting SQL queries from Informix to SQL Server:
Informix | SQL Server | |||
1 | SELECT FIRST n … | Return n rows after sorting | SELECT TOP n … | |
2 | OUTER clause | Outer join syntax | ANSI SQL OUTER JOIN clause |
Create table from query:
Informix | SQL Server | |||
1 | SELECT ... FROM ... INTO TEMP tab | Create a temporary table | SELECT ... INTO #tab FROM ... |
GROUP BY clause:
Informix | SQL Server | |||
1 | SELECT c1, c2, … FROM t GROUP BY 1, 2 | Positional reference | SELECT c1, c2, … FROM t GROUP BY c1, c2 |
Converting user-defined functions:
Informix | SQL Server | ||
1 | CREATE FUNCTION name | CREATE FUNCTION name | |
2 | END FUNCTION | End of function block | END GO |
3 | DOCUMENT "notes", … | User notes for procedure | Commented |
4 | WITH LISTING IN 'file' | Warnings file | Removed |
For more information, see Conversion of Procedural Statements.
Converting stored procedures:
Informix | SQL Server | ||
1 | CREATE PROCEDURE name | CREATE PROCEDURE name | |
2 | name() | When without parameters | name |
3 | OUT | INOUT param datatype(len) DEFAULT default | @param datatype(len) = default OUT | |
4 | RETURNING datatype | Scalar return value | Converted to CREATE FUNCTION |
RETURN WITH RESUME | Multiple rows returned | Converted to a table-valued function | |
5 | No AS keyword before the statements block | AS is added | |
6 | END PROCEDURE | End of procedure block | GO |
7 | DOCUMENT "notes", … | User notes for procedure | Commented |
8 | WITH LISTING IN 'file' | Warnings file | Removed |
For more information, see Conversion of Procedural Statements.
Variable declaration and assignment:
Informix | SQL Server | ||
1 | variable LIKE table.column | Inherited data type | @variable datatype |
2 | DEFINE var datatype(len) | Variable declaration | DECLARE @var datatype(len) |
3 | LET var = value; | Assignment statement | SET @var = value; |
4 | SELECT col INTO var FROM | Select a single row | SELECT @var = col FROM |
Flow-of-control statements:
Informix | SQL Server | ||
1 | FOREACH SELECT ... END FOREACH | Query loop | DECLARE, OPEN, WHILE, FETCH and CLOSE |
2 | FOR i = n TO k ... END FOR | Range loop | WHILE @i <= k BEGIN ... END |
3 | EXIT FOR | Exit loop | BREAK |
4 | IF cond THEN … ELIF … ELSE … END IF | IF statement | IF cond BEGIN … END ELSE IF … ELSE … |