From: | Jorge Arevalo <jorgearevalo(at)gis4free(dot)org> |
---|---|
To: | Andre Lopes <lopes80andre(at)gmail(dot)com> |
Cc: | postgresql Forums <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Dynamic SQL with pgsql, how to? |
Date: | 2010-05-03 08:55:47 |
Message-ID: | y2td321138e1005030155nff63077axa5920c8b61da0b62@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, May 3, 2010 at 10:44 AM, Andre Lopes <lopes80andre(at)gmail(dot)com> wrote:
> Hi,
>
> I need to write some dynamic SQL in pgsql.
>
> I have to do something like this:
>
> [code=SQL Server]
> SET @STRINGN = @STRINGN + ' AND A.' + @CAMPOFECINI + ' IN (SELECT
> MAX(B.' + @CAMPOFECINI + ')
> FROM ' + @TABLA + ' B
> WHERE B.ID_SOCIEDAD = A.ID_SOCIEDAD
> AND B.ID_EMPREGAD = A.ID_EMPREGAD'
> IF @F_ALTA IS NOT NULL
> SET @STRINGN = @STRINGN + ' AND B.DAT_INI_ACT_EMP =
> A.DAT_INI_ACT_EMP'
> SET @STRINGN = @STRINGN + ')'
> EXEC sp_executesql @STRINGN,
> N'@FINI2 datetime out, @FFIN2 datetime out, @CAMP2
> varchar(50) out',
> @FINI out, @FFIN out , @CAMP out
> [/code]
>
> There is documentation on how can I do this in pgsql?
>
> Best Regards,
>
Hi Andre,
This may helps
Best regards,
Jorge
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2010-05-03 09:05:21 | Re: Dynamic SQL with pgsql, how to? |
Previous Message | Andre Lopes | 2010-05-03 08:44:28 | Dynamic SQL with pgsql, how to? |