All Products
Search
Document Center

:Migrate SQL Server to Babelfish for PostgreSQL

Last Updated:Jun 20, 2026

This topic describes how to migrate a database from SQL Server to Babelfish for ApsaraDB RDS for PostgreSQL. Babelfish's compatibility features enable you to migrate quickly without extensive code rewrites, reducing effort and saving resources.

Prerequisites

Procedure

  1. Export table objects and data from the SQL Server database.

    1. Use the SQL Server Management Studio (SSMS) client to connect to the SQL Server database. For more information, see Connect to a SQL Server instance by using SQL Server Management Studio (SSMS).

    2. In Object Explorer, right-click the target database under the SQL Server instance, and then click Task > Generate Scripts....

    3. Complete the Generate Scripts wizard to export a .sql file.

      1. Overview: No configuration is required. Click Next.

      2. Choose Objects: Select Script entire database and all database objects, and then click Next.

      3. Set Scripting Options: Select Save as script file, specify a File Name, and then click Next.

        • To export the database schema (DDL), click Advanced. In the Advanced Scripting Options dialog box, set Script triggers to True, and click OK.

        • To export the data (DML), click Advanced and set Type of data to script to Data only.

      4. Digest: No configuration is required. Click Next.

      5. Save Scripts: No configuration is required. Click Done.

      The exported .sql file is saved to the path you specified in the Set Scripting Options step.

  2. Use the Babelfish Compass assessment tool to assess the T-SQL statements for compatibility with Babelfish and then adapt them accordingly.

    Note

    For information about how to obtain and use the Babelfish Compass tool, see the official Babelfish Compass documentation.

  3. Execute the adapted SQL statements in Babelfish.

    1. Connect to the TDS port of the Babelfish for ApsaraDB RDS for PostgreSQL instance. For more information, see Client connection examples.

    2. Execute the adapted SQL statements sequentially on the ApsaraDB RDS for PostgreSQL instance.

Related documents