6

I have a SQL Server database that I am migrating to PostgreSQL 12.0.

I have managed to migrate the schema and the tables. The applications connecting to the database rely a lot on stored procedures, which also need to be translated to PostgreSQL.

Unfortunately, the tool I was using doesn't convert stored procedures. Any ideas on how I should go about this or is there a tool which can do this?

Paul White
95.3k30 gold badges439 silver badges689 bronze badges
asked Feb 16, 2021 at 11:35
0

2 Answers 2

5

Unfortunately you'll probably have to handle the stored procedures by hand. If you're lucky, they're simple procedures following standard SQL syntax, and you'll be able to just copy the existing queries over to PostgreSQL, otherwise you'll have to handle any fallout on a case by case basis.

Side note: this is one benefit of some database agnostic ORMs like Dapper, if your database is mainly consumed by application code. By using the ORM framework's native calls, you decouple your database logic from the actual database system, but there's pros and cons.

4

There is no compete solution for migration of stored procedures and functions from SQL Server to PostgreSQL since this is a quite complicated task. However, some tools can partially automate the job by migrating generic SQL patterns and syntax constructions:

answered Sep 21, 2021 at 9:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.