pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Kumar <sgnerd@yahoo.com.sg>
To: psql <pgsql-sql@postgresql.org>
Subject: Re: Converting Query from MS SQL
Date: Mon, 6 Oct 2003 14:52:15 +0100
Message-ID: <200310061452.15939.dev@archonet.com> (raw)
In-Reply-To: <017801c38c0a$7e4bbc00$7502a8c0@hdsc.com>
References: <017801c38c0a$7e4bbc00$7502a8c0@hdsc.com>

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



view thread (2+ messages)

Message-ID: <200310061452.15939.dev@archonet.com>
Permalink:  ../200310061452.15939.dev@archonet.com/
Also on:    postgresql.org/message-id/200310061452.15939.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, sgnerd@yahoo.com.sg
  Subject: Re: Converting Query from MS SQL
  In-Reply-To: <200310061452.15939.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox