Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    137

    Unanswered: Stored Procedures

    Hi,

    Where an I find a guide on how to convert existing Microsoft SQL Server stored procedure to PostgreSQL?


    Thanks,
    Jassim

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    There is no 1:1 "conversion" from MS SQL to PostgreSQL.

    The concepts are totally different.

    I highly recommend to simply re-implement the functionality and exploit the features that PostgreSQL has, instead of trying to imitage SQL Server.

    When people try to port the technical solution of one DBMS to another they usually wind up with something that is slow and does not scale (this is true for Oracle -> SQL Serve, SQL Server -> Oracle, DB2 -> Oracle and SQL Server -> PostgreSQL just as well).

    Read the manual about stored functions (PG does not have "procedures") re-read the specification for your current solution and then simply implement it using the possibilities Postgres offers.

    I'm sure this is not the answer you were looking for, but I strongly believe that this is the only viable way to go.

  3. #3
    Join Date
    Apr 2003
    Posts
    137
    I tried to find a guide on the net but it seems to be difficult to find how convert existing sp to function.. can you please help with a sample..

    for example: I want to create two functions..

    one is just to return two columns:
    SELECT country_code, country_name FROM country_list

    and the other one is same but with parameter:
    SELECT country_code, country_name FROM country_list WHERE country_region = @country_region


    Thanks..

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by jrahma View Post
    I tried to find a guide on the net but it seems to be difficult to find how convert existing sp to function.. can you please help with a sample.
    Check out the example in the CREATE FUNCTION statement:

    http://www.postgresql.org/docs/current/static/sql-createfunction.html

Posting Permissions

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