X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4E831D1EBB0 for ; Tue, 23 Mar 2004 15:26:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 11602-05 for ; Tue, 23 Mar 2004 11:26:10 -0400 (AST) Received: from web20801.mail.yahoo.com (web20801.mail.yahoo.com [216.136.226.190]) by svr1.postgresql.org (Postfix) with SMTP id 3E5B0D1E29F for ; Tue, 23 Mar 2004 11:26:05 -0400 (AST) Message-ID: <20040323152604.94169.qmail@web20801.mail.yahoo.com> Received: from [24.248.12.72] by web20801.mail.yahoo.com via HTTP; Tue, 23 Mar 2004 07:26:04 PST Date: Tue, 23 Mar 2004 07:26:04 -0800 (PST) From: Jeff Eckermann Subject: Re: postgresql equivalent to ms access parameter query To: "David P. Lurie" , pgsql-odbc@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/72 X-Sequence-Number: 3874 --- "David P. Lurie" wrote: > What is the postgresql equivalent to an ms access > 2002 parameter query? > > Postgresql functions written in SQL that return sets > from select queries > seem closest. If you like. But see below. > > Table stores has columns of storeid, name, address, > etc. > > A postgresql SQL procedure retrieves records based > on a single column > parameter: > > CREATE OR REPLACE FUNCTION public.state(varchar) > RETURNS SETOF stores AS > ' > SELECT * from stores where stateorprovince = $1; > ' > LANGUAGE 'sql' VOLATILE; > > The following SQL statement runs as expected from > psql or the pgAdminIII > query window: > > SELECT storeid,storename from state('TN'); > > How is a parameter passed from access to postgresql > in a pass-through query > calling a function? You've unwittingly provided yourself with the answer below, i.e. construct a query string using the value of some control(s). You just need a piece of code that makes a connection to the server, constructs a query string, then sends the query to the server. ADO is good for this. So you don't really need a function, because either way you are doing the same thing, i.e. creating a query string using passed in values. > > A standard access query (non pass-through) to the > postgresql table can > reference a text box control on a form: > > SELECT public_stores.storeid, > public_stores.storename, > public_stores.address, public_stores.city, > public_stores.stateorprovince, > public_stores.postalcode > FROM public_stores > WHERE > (((public_stores.stateorprovince)=[Forms]![Form1]![Text0])); > > Thanks, > > David P. Lurie > > > > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please > send an appropriate > subscribe-nomail command to > majordomo@postgresql.org so that your > message can get through to the mailing list cleanly __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html