X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1E2ABD1B54D for ; Mon, 6 Oct 2003 13:53:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 69691-04 for ; Mon, 6 Oct 2003 10:52:23 -0300 (ADT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 9AC2FD1B56E for ; Mon, 6 Oct 2003 10:52:19 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1A6Vmc-000GMv-0V; Mon, 06 Oct 2003 14:52:18 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 1DBDE17138; Mon, 6 Oct 2003 14:52:17 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 6AD551681E; Mon, 6 Oct 2003 14:52:16 +0100 (BST) From: Richard Huxton To: "Kumar" , "psql" Subject: Re: Converting Query from MS SQL Date: Mon, 6 Oct 2003 14:52:15 +0100 User-Agent: KMail/1.5 References: <017801c38c0a$7e4bbc00$7502a8c0@hdsc.com> In-Reply-To: <017801c38c0a$7e4bbc00$7502a8c0@hdsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310061452.15939.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/67 X-Sequence-Number: 15467 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