473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Convert PostgreSQL DB to MS-SQL

Hi,
I want to convert my complete database of PostgresQL to MS-SQL.
I am some what successful in converting tables but the major problem is Functions and Triggers.


Please help.
Oct 10 '08 #1
2 4977
ck9663
2,878 Expert 2GB
Post your stored proc and functions and we can try to help you convert it.Depending on the logic and business rules of your procedure and functions, it might not be able to be translated line by line. Instead, some (or all) of them might be completely re-written.

-- CK
Oct 10 '08 #2
Post your stored proc and functions and we can try to help you convert it.Depending on the logic and business rules of your procedure and functions, it might not be able to be translated line by line. Instead, some (or all) of them might be completely re-written.

-- CK
One of the Function:

Expand|Select|Wrap|Line Numbers
  1. -- Function: sp_get_form_bag_content(bigint, bpchar)
  2.  
  3. -- DROP FUNCTION sp_get_form_bag_content(bigint, bpchar);
  4.  
  5. CREATE OR REPLACE FUNCTION sp_get_form_bag_content(in_cand_id bigint, in_payment_mode bpchar)
  6.   RETURNS SETOF typ_form_bag_content AS
  7. $BODY$
  8. DECLARE
  9.  
  10.    v_form_id_arr _int2;
  11.    v_rec form_bag%ROWTYPE;
  12.    v_return_rec typ_form_bag_content;
  13.    v_index int2;
  14.  
  15. BEGIN
  16.  
  17. update cand_preferences
  18.    set payment_mode = in_payment_mode
  19.    where cand_id = in_cand_id
  20.    and   payment_mode <> in_payment_mode;
  21.  
  22. v_index=0;
  23. for v_rec in select form_id from form_bag where cand_id=in_cand_id
  24. loop
  25.    v_form_id_arr[v_index]= v_rec.form_id;
  26.    v_index = v_index + 1;
  27. raise notice '%', v_form_id_arr[0];
  28. end loop;
  29.  
  30.  
  31. for v_return_rec in
  32. select temp2.form_id, college_name, course_list, form_cost, warning, sp_format_date(last_date,'DD-Mon-YYYY, DOW'), is_exam from (
  33. select college_id, temp.form_id, course_list, form_cost, warning, last_date, is_exam from
  34.    (    
  35.    select sp_warnings_cost.form_id, course_list, warning, form_cost from
  36.         (
  37.             select sp_cost.form_id, coalesce(sp_warnings.warning,'') as warning, sp_cost.form_cost from
  38.                 (
  39.                  select form_id,
  40.                     array_to_string(array_accum(warnings), '::') as warning
  41.                    from (
  42.                      select  *
  43.                         from sp_check_form_constraints(in_cand_id, v_form_id_arr)
  44.                     ) as sp1_warnings
  45.                    group by form_id
  46.                 ) as sp_warnings
  47.  
  48.                right outer join sp_get_forms_cost(in_cand_id, v_form_id_arr) as sp_cost on sp_cost.form_id=sp_warnings.form_id
  49.         ) as sp_warnings_cost
  50.  
  51.           left outer join sp_get_form_bag_courses(in_cand_id) sp_courses on sp_warnings_cost.form_id=sp_courses.form_id
  52.    ) as temp
  53.     inner join forms f on f.form_id=temp.form_id
  54. )temp2
  55. inner join colleges col on col.college_id=temp2.college_id
  56. loop
  57.  
  58. return next v_return_rec;
  59.  
  60. end loop;
  61.  
  62. return;
  63. END;
  64. $BODY$
  65.   LANGUAGE 'plpgsql' VOLATILE
  66.   COST 100
  67.   ROWS 1000;
  68. ALTER FUNCTION sp_get_form_bag_content(bigint, bpchar) OWNER TO postgres;
  69.  
Nov 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: G Lam | last post by:
Hi, I have some experience in MS Access 97 and 2000 and did write some application with them. Now, I want to learn PostgreSQL. I installed it on a RH8.0 server. Which books would you guys...
4
by: Chris M. Gamble | last post by:
Does anyone know a good commercial application that does multi-master replication for postgres? Thanks ---------------------------(end of broadcast)--------------------------- TIP 2: you can...
26
by: jini us | last post by:
Hi, I am starting a new project where I intend to use embedded database server in my win32 application. I intend to use VC++ microsoft studio 6.0 as my development environment. The...
11
by: Durai | last post by:
Hi All, I tested "concurrent testing" in MySQL. It works fine. But I couldn't do in PostgreSQL 7.3.4 on HPUX IPF. I got deadlock problem. I used the PHP script to update table( one script...
0
by: btober | last post by:
I noticed this gem for allowing the saving of MS-Project 2000 data into a Postgresql database, http://techdocs.postgresql.org/source.php#fmsproject posted by John P Cavanaugh probably a...
13
by: Zlatko Matić | last post by:
Is it possible to use Access as front-end for POstgreSQL and how ? What about Access Projects (.adp) and PostgreSQL ?
19
by: Alex Madon | last post by:
Hello, I am testing a web application (using the DBX PHP function to call a Postgresql backend). I have 375Mb RAM on my test home box. I ran ab (apache benchmark) to test the behaviour of the...
4
by: Chris Ochs | last post by:
We have a number of tables in a CRM that is written in MS access that I need to be able to provide a web interface to. I can export the tables just fine using pgadmin II, but I cant' think of a...
1
by: hergele | last post by:
Hello all.. I am trying to convert an application which is working on Oracle to postgreSql.. I've seen a query in code something like this... select * from table1 a1 , table1 a2, table2 a3, ...
0
by: shajimon | last post by:
hai All I am very new to PostgreSql. I have given the following code to VB 6. and it takes around 2 to 3 minutes to exicute with PostgreSQL back end. However, the same code work in a fraction of a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.