472,955 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Porting SQL Server 2000 database to PostgreSQL

I have the task of converting a SQL Server 2000 database to
PostgreSQL. The data itself does not need to be converted, but the
structure and stored procedures must be.

I expect that converting tables and views will be simple. I expect
that converting stored procedures and user-defined functions from
T-SQL to PostgreSQL will be more complex.

In any case, I am looking for recommendations and counsel regarding my
expectations. I have much Windows 2000/NT and SQL Server experience,
and some Unix/Linux experience, probably post-beginner level. (I used
to work with Unix and VMS all the time in college 15 years ago but
haven't touched it since.)

I plan to use a Windows client such as pgAdminIII to administer and
work with the database in PostgreSQL. The database is used by a
WindowsCE application, so I will need to change its data access layer
from SQLClient to whatever is needed in CE and Windows to access
PostgreSQL.

Thank you in advance for your recommendations, advice, warnings,
gripes, etc.

Rod Early
Nov 23 '05 #1
3 2078
1. stored procedures are now called functions

2. unlike ms tsql, in postgres query analyzer you can't test
conditional statements and variables outside of a function. this makes
debugging really hard.

3. inside the function single quotes must be escaped because your
function is entered in as a string literal.

4. to return recordsets you must create a custom return TYPE and use a
FOR loop with %ROWTYPE to interate thru the data.

5. you can overload functions. two function with the same name but
different input fn_foo(int) OR fn_foo(int, varchar).

6. temp tables don't work well in functions unless you make them
dynamically with execute. instead use normal tables and your pid.

favorite editor: editplus w/ psql definitions
Nov 23 '05 #2
Rod Early wrote:
I have the task of converting a SQL Server 2000 database to
PostgreSQL. The data itself does not need to be converted, but the
structure and stored procedures must be.

I expect that converting tables and views will be simple. I expect
that converting stored procedures and user-defined functions from
T-SQL to PostgreSQL will be more complex.
There are a couple of notes on the techdocs site detailing conversion
from MS-SQL.
http://techdocs.postgresql.org/
Where you'll need to put some extra work in:
- Returning multiple recordsets from a function/stored-proc (we don't)
- In/out parameters (pass by ref) - we don't
- Exception handling (needs improvement)
You have some useful new tools available:
- Partial/conditional/functional indexes
- Lots of different procedural languages available
- a bunch of stuff that has slipped my mind momentarily
Oh, PG returns the complete result set in one go, so if you want to see
the first row of 100,000 quickly use an explicit cursor.
In any case, I am looking for recommendations and counsel regarding my
expectations. I have much Windows 2000/NT and SQL Server experience,
and some Unix/Linux experience, probably post-beginner level. (I used
to work with Unix and VMS all the time in college 15 years ago but
haven't touched it since.)
The standard guide to the config file and performance tuning is at
"GeneralBits":
http://www.varlena.com/varlena/Gener...bits/index.php
I plan to use a Windows client such as pgAdminIII to administer and
work with the database in PostgreSQL. The database is used by a
WindowsCE application, so I will need to change its data access layer
from SQLClient to whatever is needed in CE and Windows to access
PostgreSQL.


Looks like you've found the .net/odbc libraries in your next post. Can't
say anything about CE as an environment.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #3
On Fri, 2004-05-21 at 02:49, anony wrote:
3. inside the function single quotes must be escaped because your
function is entered in as a string literal.

be aware that your editor might quote these for you (at least some of
the admin apps do, not sure about PgAdminIII though)
4. to return recordsets you must create a custom return TYPE and use a
FOR loop with %ROWTYPE to interate thru the data.


this isn't always true... see
http://techdocs.postgresql.org/guide...rningFunctions

And while you're there check out the section on the main page about
converting from other databases, there are a couple on $ql server. Also
take notes on your conversion and submit your own article when your done
:-)
Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gordan | last post by:
Hi, I have a site written in PHP with MS SQL Server 2000 as the db backend. When the site was made there was no need for advanced banner rotation so a 10 line script was written and it served...
0
by: Bill J. | last post by:
I have to update a PostgreSQL linked server through MSSQL2K. I first configured the connection with ODBC as follows and I can do queries with no problem: EXEC sp_droplinkedsrvlogin @rmtsrvname...
11
by: Errol Neal | last post by:
Hi all, Not sure if this is a question for a php list or this one, but I'll give it a shot and if I am wrong, please do not crucify me. :-) There is a php based sourceforge project called...
1
by: Lane Beneke | last post by:
All, New to the list and a relative newbie to PostgreSQL. Please forgive stupid questions. Designing an application server for a work order processing (et al) database. I have a good handle...
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...
4
by: Chris Travers | last post by:
Hi all; A few years ago, I set about porting a PHP application from MySQL to PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. In order to do this, I built a light,...
1
by: Janez Kostanjček | last post by:
Hello everyone, this is my first post to postgres mailing list. System that I use: I am using Postgres under last CygWin published on public mirrors at the moment. OS system runing is...
1
by: pwbyrne | last post by:
Hi, I'm looking for details, or tools about porting a full Ms Sql Server 2000 database to Postgres on Linux. Is this possible? We have the whole nine yards, stored procedures, triggers, and...
5
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.