473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2115
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
3381
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
3828
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
2895
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
3466
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
1602
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
2358
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
4643
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
1692
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
2897
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
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
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...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.