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



.