Re: substitute variable in sql?

From: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
To: 'Doug McNaught' <doug(at)mcnaught(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: substitute variable in sql?
Date: 2002-10-29 16:35:42
Message-ID: 73309C2FDD95D11192E60008C7B1D5BB04C74133@snt452.corp.bcbsm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--thanks for the reply

--i just have an sql script that i launch
--by hand (psql -U <user> -d <database> -f ./<script>)

--the date is a rolling date which is supposed to
--change every 3 months. and as variable 1 is moved
--up every month, so should variable 2 move up every
--month.

--the result is var1 and var2 should always be
--3 months apart every month (or, every time i
--run the script).

--now i *could* run psql from a shell ... can i
--substitute a variable and just stick it in place
--when i run the sql script?

--thanks again!

-X

-----Original Message-----
From: Doug McNaught [mailto:doug(at)mcnaught(dot)org]

"Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> writes:

> Running PostgreSQL 7.2.1 on RedHat Linux 7.2:
>
> I have a query where I have to replace the
> date parameter each time I run the query.
>
> Is there a way to substitute just the date
> parameter in the sql without having to
> edit the script, re-run and edit again?

There are loads of ways to do this. What client language are you
using? Are you running 'psql' from a shell script?

-Doug

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2002-10-29 17:01:28 Re: substitute variable in sql?
Previous Message Doug McNaught 2002-10-29 16:19:31 Re: substitute variable in sql?