Skip site navigation (1) Skip section navigation (2)

Re: [pgadmin-support] pgadtransport Procedural and Function from MS SQL Enterprise Manage to PostgreSQL

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "XIE, Rong" <rong(dot)xie(at)stud(dot)tu-muenchen(dot)de>,<pgsql-docs(at)postgresql(dot)org>
Cc: <pgadmin-support(at)postgresql(dot)org>,"pgadmin-hackers" <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgadmin-support] pgadtransport Procedural and Function from MS SQL Enterprise Manage to PostgreSQL
Date: 2002-09-17 09:07:22
Message-ID: 03AF4E498C591348A42FC93DEA9661B86825@mail.vale-housing.co.uk (view raw or flat)
Thread:
Lists: pgadmin-hackerspgadmin-supportpgsql-docs
You will have to port your functions and procedures manually I'm afraid.
 
Regards, Dave.

	-----Original Message-----
	From: XIE, Rong [mailto:rong(dot)xie(at)stud(dot)tu-muenchen(dot)de] 
	Sent: 17 September 2002 09:59
	To: pgsql-docs(at)postgresql(dot)org
	Subject: [pgadmin-support] transport Procedural and Function from MS SQL Enterprise Manage to PostgreSQL 
	
	
	hallo,

	I have PostgreSQL in Linux. I use it with pgAdminII in Wondows2000.
	how can I transport Procedural and Function from MS SQL Enterprise Manage to
	PostgreSQL.
	Thanks!!!
	rong
	
	
	CREATE FUNCTION dbo.getICNroh (@Bogen_Nr smallint)
	RETURNS smallint AS
	BEGIN
	    DECLARE @myRet int
	--Rohwert der Skala 1 (ICN) ermitteln
	    DECLARE @step01a smallint
	    DECLARE @step02a smallint
	
	    DECLARE @step01b smallint
	    DECLARE @step02b smallint
	
	    SELECT @step01a = Antwort FROM PAI_ANTWORTEN WHERE ITEM_NR = 75 AND
	Bogen_Nr = @Bogen_Nr
	    SELECT @step01b = Antwort FROM PAI_ANTWORTEN WHERE ITEM_NR = 115 AND
	Bogen_Nr = @Bogen_Nr
	
	    SELECT @step02a = Antwort FROM PAI_ANTWORTEN WHERE ITEM_NR = 4 AND
	Bogen_Nr = @Bogen_Nr
	    SELECT @step02b = Antwort FROM PAI_ANTWORTEN WHERE ITEM_NR = 44 AND
	Bogen_Nr = @Bogen_Nr
	
	
	    SELECT @myRet = ABS(@Step01a - @step01b)
	              + ABS(@Step02a - @step02b)
	
	--Wert zurückgeben
	    RETURN @myRet
	END
	
	
	
	
	
	
	CREATE PROCEDURE sp_PAI_Werte
	    @Bogen_Nr int
	 AS
	
	
	create table #tmpPAI_Rohwerte (Skala_Nr smallint primary key, Rohwert
	smallint)
	
	--Rohwerte ermitteln (außer Skala 1 ICN)
	INSERT into #tmpPAI_Rohwerte
	SELECT dbo.PAI_SKALEN.Skala_Nr, sum((CONVERT(tinyint,
	                      dbo.PAI_ANTWORTEN.Antwort) + dbo.PAI_KEYcalc.toAdd) *
	dbo.PAI_KEYcalc.Faktor) AS Rohwert
	FROM dbo.PAI_SKALEN INNER JOIN
	                      dbo.PAI_ITEMinSKALA ON dbo.PAI_SKALEN.Skala_Nr =
	dbo.PAI_ITEMinSKALA.Skala_Nr INNER JOIN
	                      dbo.PAI_ITEMS ON dbo.PAI_ITEMinSKALA.Item_Nr =
	dbo.PAI_ITEMS.Item_Nr INNER JOIN
	                      dbo.PAI_ANTWORTEN ON dbo.PAI_ITEMS.Item_Nr =
	dbo.PAI_ANTWORTEN.Item_Nr INNER JOIN
	                      dbo.PAI_KEYcalc ON dbo.PAI_ITEMinSKALA.keyDir =
	dbo.PAI_KEYcalc.keyDir
	WHERE (dbo.PAI_ANTWORTEN.Antwort <> ' ') and PAI_Antworten.Bogen_Nr =
	@Bogen_Nr
	GROUP BY dbo.PAI_SKALEN.Skala_Nr
	
	--ICN Rohwert einfügen
	IF EXISTS(SELECT * from #tmpPAI_Rohwerte WHERE Skala_Nr = 1)
	    UPDATE #tmpPAI_Rohwerte SET Rohwert = dbo.getICNroh(@Bogen_Nr) WHERE
	Skala_Nr = 1
	ELSE
	    INSERT INTO #tmpPAI_Rohwerte (Skala_Nr, Rohwert)
	VALUES(1,dbo.getICNroh(@Bogen_Nr))
	
	--T-Werte bereitstellen
	SELECT dbo.PAI_SKALEN.Skala_Nr, dbo.PAI_SKALEN.Kuerzel_D AS Kuerzel,
	dbo.PAI_SKALEN.Label_D AS Label, #tmpPAI_Rohwerte.rohwert as rohwert,
	                      ROUND(50 + (#tmpPAI_Rohwerte.rohwert -
	dbo.PAI_SKALEN.M) *10 / dbo.PAI_SKALEN.SD, 0) AS TWert
	FROM dbo.PAI_SKALEN LEFT OUTER JOIN
	                      #tmpPAI_Rohwerte ON dbo.PAI_SKALEN.Skala_Nr =
	#tmpPAI_Rohwerte.skala_nr
	GO
	
	
	

Responses

pgsql-docs by date

Next:From: Hong LiDate: 2002-09-20 10:53:38
Subject: more document about postgres extension of JDBC
Previous:From: Tom LaneDate: 2002-09-09 19:24:18
Subject: Re: RESTRICT / CASCADE

pgadmin-hackers by date

Next:From: Poul L. ChristiansenDate: 2002-09-26 11:11:27
Subject: Can't connect to PostgreSQL 7.3 beta2
Previous:From: XIE, RongDate: 2002-09-17 08:59:26
Subject: transport Procedural and Function from MS SQL Enterprise Manage to PostgreSQL

pgadmin-support by date

Next:From: Camacho, ChristianDate: 2002-09-17 18:25:26
Subject: pgAdmin II Migration Wizard
Previous:From: XIE, RongDate: 2002-09-17 08:59:26
Subject: transport Procedural and Function from MS SQL Enterprise Manage to PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group