Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2016

    Unanswered: MSSQL Stored Procedures Migration to Postgres


    I would like to know if there is any open or paid tool out there which can convert the MSSQL Stored Procedures to Postgres functions?

    I would really appreciate if anyone can put some light on this topic.

    Thanks in Advance.

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    There have been a number of tools that were created to solve very specific problems in converting Microsoft SQL Server Stored Procedures to PostgreSQL functions. Most of the ones that I've seen were built to translate machine generated code, so they made a number of very broad assumptions that were fine for a specific problem but did not work very well for general cases.

    Out of a few hundred attempts, I've seen about a dozen that do a good job at a very specific conversion. I've never seen a general purpose converter that worked well.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Nov 2003
    Provided Answers: 23
    There are some tools that help with the migration, a list of them is available in the Postgres Wiki:

    But I highly doubt there is any tool that can convert a T-SQL stored procedure to PL/pgSQL - those two are just way too different. And if there was such a tool you'd probably be spending a more time validating the converted procedures then it would have taken you to migrate them manually.

    And even if you get the syntax right, those two systems are just too different. You'd probably wind up with something that doesn't perform very well. The typical (excessive) use of temp tables in SQL Server based systems (mainly because of its mediocre locking behaviour) usually isn't necessary in Postgres (or other DBMS like Oracle) due to it's much better concurrency implementation.

    Doing things the "SQL Server" way in any other DBMS is never a good idea (the other way round is of course also true!)
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags:

    Tips for good questions:

  4. #4
    Join Date
    Jan 2016
    Thank you for the replies!

    Pat, you mentioned that there are number of tools but may not be perfect. Can you point me to few of them you may know. Because during my research I didnt come across anyone which does stored proc migration.

    Thanks in advance
    Last edited by a_nndy; 01-18-16 at 18:45.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts