Re: cobol embedded sql source example
- From: "Michael Mattias" <michael.mattias@xxxxxxx>
- Date: Wed, 03 May 2006 17:39:13 GMT
"Binyamin Dissen" <postingid@xxxxxxxxxxxxxxxxxx> wrote in message
On Wed, 03 May 2006 15:59:31 GMT "Michael Mattias"<michael.mattias@xxxxxxx>
:>A "SELECT * from tablename" may not return the column names if the
:>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.
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 'INORDER.'
(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.