Re: Host Variable in dbaccess sql script.
Posted in 1997
Terron Wright wrote:
>
> Is it possible to create a SQL statement with HOST Variables within the
> script. Here is an example of something I am wanting to do:
>
> USER=TWRIGHT
> select xuser from xcp
> where xuser = '$USER';********************"$USER"****
Try using the " quote instead of the ' quote. But this still won't help
you if you want to put a shell variable into the script. However, the
following does work:
$ dbaccess docdb - <<%%
..more>> select tabname, tabid
..more>> from systables
..more>> where owner = "$LOGNAME"
..more>> ;
..more>> %%
Database selected.
--- SNIP (Confidential table names censored) --
13 row(s) retrieved.
Database closed.
> I am running this script from the command line by doing:
> dbaccess -e database user.sql.>
> It appears to run but DBACCESS converts the host variable USER which is
> TWRIGHT into twright. The user is not in the system in lowercase but
> uppercase. Can someone give me a few pointers.
--
-- Jake (In pursuit of undomesticated aquatic avians)
+-----------------------------------------------------------+
| Impeccable Logic: A thought process which successfully |
| resists chicken bites |
+-----------------------------------------------------------+