SQLines tools can help you convert database schema (DDL), views, stored procedures, functions, triggers, queries and SQL scripts from PostgreSQL (Postgres) to Microsoft SQL Server (MSSQL, MS SQL), Azure SQL, Azure Synapse and Fabric.
Databases:
Converting string functions:
PostgreSQL | SQL Server | ||||
1 | RPAD(string, len, pad) | Pad the right-side of string | LEFT(string + REPLICATE(pad, len), len) | ||
2 | TRIM(string) | Remove leading and trailing blanks from string | TRIM(string) | Since SQL Server 2017 | |
RTRIM(LTRIM(string)) |
Converting datetime functions:
PostgreSQL | SQL Server | ||||
1 | TO_TIMESTAMP(string, format) | Convert string to timestamp | CONVERT(DATETIME, string, style) |
Converting CREATE TABLE statement keywords and clauses.
For Synapse:
PostgreSQL | Synapse | ||
1 | PRIMARY KEY (col) | Primary key constraint | PRIMARY KEY NONCLUSTERED (col) NOT ENFORCED |
2 | UNIQUE (col) | Unique constraint | UNIQUE (col) NOT ENFORCED |