Re: Converting Query from MS SQL

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Kumar" <sgnerd(at)yahoo(dot)com(dot)sg>, "psql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Converting Query from MS SQL
Date: 2003-10-06 13:52:15
Message-ID: 200310061452.15939.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Monday 06 October 2003 14:04, Kumar wrote:
> Dear Friends,
>
> I am working with Postgres 7.3.4 on RH Linux 7.2. While migrating all the
> SPs (from MS SQL Server), I come across these lines in MS SQL Server
> procedure.
>
> SET @v_sql = "UPDATE "Schema1".employee SET rec_deleted_flag = 'Y' WHERE
> empid IN (" + @p_list_ids + ");" EXEC(@v_sql)
>
> Actually to dynamically pass the values for the 'IN' the pass the
> @p_list_ids (a comma separated string ) to the variable @v_sql and then
> execute it.
>
> How can I change it for postgres?

Something like (in plpgsql):

EXECUTE ''UPDATE "Schema1".employee SET ...'' || my_list_var || '')'';

See the manuals for more details.
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bill Pfeiffer 2003-10-06 14:40:52 PG equivalent to Sybase varbinary
Previous Message Popeanga Marian 2003-10-06 13:32:42 Re: output