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 from Informix to SQL Server:
Informix | SQL Server | |||
1 | { comment } | /* comment */ | ||
2 | string[start, end] | Substring operator [] | SUBSTRING(string, start, end - start + 1) | |
string[start] | SUBSTRING(string, start, 1) | |||
3 | DBINFO('sqlca.sqlerrd2') | Get the number of affected rows | @@ROWCOUNT |
Character data types:
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 built-in SQL functions:
Informix | SQL Server | |||
1 | CURRENT | Get the current date and time | GETDATE() | |
2 | DBINFO('sqlca.sqlerrd2') | Get the number of affected rows | @@ROWCOUNT | |
3 | DECODE(exp, when, then, …, else) | Evaluate conditions | CASE exp WHEN when THEN then … ELSE else END |
|
4 | LEN(string) | Get string length | LEN(string) | |
LENGTH(string) | ||||
5 | 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 |
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 stored procedures from Informix to SQL Server:
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 |
For more information, see Conversion of Procedural Statements.
Converting procedural SQL statements (SPL) used in stored procedures, functions and triggers from Informix to SQL Server.
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 [cur FOR] select INTO vars stmt END FOREACH | Query loop | DECLARE cur CURSOR FOR select; OPEN-WHILE-FETCH-CLOSE |
2 | IF condition THEN … END IF; | IF statement | IF condition BEGIN … END |