Re: SQL from the command line
Posted in 1995
Michel Behna (mbehna@promus.com) wrote:
: In article <3idm0i$12h@crchh327.bnr.ca> Andy Cordell <andy@bnr.ca> writes:
: >From: Andy Cordell <andy@bnr.ca>
: >Subject: SQL from the command line
: >Date: 21 Feb 1995 21:29:54 GMT
: >Hello all,
: >What is the proper way to provide a SQL command line interface to
: >a user without making them create a sql command file to issue a
: >command? What I'd like is the ability to type something like
: >this on the unix command line:
: ><dbname> <SQL command here>
: >The response would come back to stdout.
: >This is the almost working script that I wrote:
: >#! /bin/sh
: >echo "$@" > temp.sql
: >dbaccess -e <dbname> temp.sql
: >The only problem with this is that it expands the * in
: >"select * from <table> " to be the current directory listing, so
: >I end up with :
: >select <insert really big directory listing here> from <table>
: >as my SQL command, which is not good.
: >Is this the right approach? Is there already a utility that will
: >provide SQL statements (not cmd files) from the command line?
: >Any help is much appreciated!
: >Andy Cordell
: >andy@bnr.ca
: How about the following:
: isql dbname <<-!
: select * from tables
: !
: Use the here document feature of Unix.
A here document is hardly dynamic!
I don't understand the requirement to enter the SQL at the command line.
Why isn't "dbaccess <dbname> -" acceptable, Michel???
--
graeme
--
Disclaimer: The author's opinions are his own, and not necessarily
those of Pyramid Technology Ltd. or Pyramid Technology Inc.
---------------------------------------------------------------------------
-m------- Graeme Sargent Voice: +44 (0)252 373035
---mmm----- Senior Database Consultant Fax : +44 (0)252 373135
-----mmmmm--- Pyramid Technology Ltd. Telex: Tell who???
-------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk
---------------------------------------------------------------------------
We have the technology. The tricky bit is learning how to use it.