Re: cobol embedded sql source example



"Binyamin Dissen" <postingid@xxxxxxxxxxxxxxxxxx> wrote in message
news:0bmh52hnrqjpkdkv9icdcodpge1le2ff51@xxxxxxxxxx
On Wed, 03 May 2006 15:59:31 GMT "Michael Mattias"
<michael.mattias@xxxxxxx>
wrote:

:>A "SELECT * from tablename" may not return the column names if the
table
:>is empty. If available on whatever system you are working on a catalog
:>function might be a better choice.

You don't execute it, you prepare it.

Thanks.

I looked this up for ODBC, and it looks like that may be the answer to a
long-standing problem I have had.

The problem is, I have to work with ODBC version 2, in which the SqlColumns
catalog function does not return the ordinal position of a column within a
table. (I am checking that the user's database has all the right tables and
columns before I let him select that database as his current database)

But, following your lead, it looks like.........

SqlPrepare "SELECT * FROM Table_Name"
SqlNumParams ==> should return the number of columns in the result set
SqlDescribeCol ==> should return the name of the column.

From this I should be able to create list a of 'columns in this table 'IN
ORDER.'

(SqlColumns when using ODBC-3 DOES return the ordinal position of each
column in the table).

Sheesh, I can hardly wait to test this now!

--
Michael C. Mattias
Tal Systems Inc.
Racine WI
mmattias@xxxxxxxxxxxxxx



.



Relevant Pages

  • SQLColumns hangs on DB link synonym in Oracle 9.2
    ... Oracle 9.2 database via ODBC. ... I use the SQLColumns ODBC function ... invoked on mysyn hangs forever. ...
    (microsoft.public.data.odbc)
  • Re: ODBC SQLColums is very slow
    ... I ran SQLColumns in SQL_TRACE mode and found that it submits the ... The database has plenty of RAM and nothing much to do. ... you might consider switching from an ODBC connection string to ...
    (comp.databases.oracle.server)
  • ODBC: SQLColumns hangs on DB link synonym in Oracle 9.2
    ... Oracle 9.2 database via ODBC. ... I use the SQLColumns ODBC function ... invoked on mysyn hangs forever. ...
    (comp.databases.oracle.server)
  • Re: Nameless CREATE
    ... The starting point is either an existing database or one that is ... "Describe" involves issuing an SQLDescribeCol function to ODBC ... essentially much the same as character data type apart from all 8 bits ... ALTER TABLE tablename ADD COLUMN BinaryColumn BINARY ...
    (comp.lang.forth)
  • Re: fields queries and utter disaster
    ... Unfortunately the \c ODBC DATABASE field switch is not supported in Word ... of course supports ODBC connections but Word ... Mac Word Test ... suggests that it should be possible to use query files (cf. .qry/.dqy ...
    (microsoft.public.mac.office.word)