pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Converting Query from MS SQL
2+ messages / 2 participants
[nested] [flat]

* Converting Query from MS SQL
@ 2003-10-06 13:04 Kumar <sgnerd@yahoo.com.sg>
  2003-10-06 13:52 ` Re: Converting Query from MS SQL Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kumar @ 2003-10-06 13:04 UTC (permalink / raw)
  To: pgsql-sql

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?

Thank you very much for ur support


Regards
Kumar

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Converting Query from MS SQL
  2003-10-06 13:04 Converting Query from MS SQL Kumar <sgnerd@yahoo.com.sg>
@ 2003-10-06 13:52 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2003-10-06 13:52 UTC (permalink / raw)
  To: Kumar <sgnerd@yahoo.com.sg>; 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-10-06 13:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-06 13:04 Converting Query from MS SQL Kumar <sgnerd@yahoo.com.sg>
2003-10-06 13:52 ` Richard Huxton <dev@archonet.com>

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