By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,590 Members | 2,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,590 IT Pros & Developers. It's quick & easy.

How to get structure of temporary table ?

P: n/a
Hi
Db2UDB version 8.2
Is possible difrent way than this

DECLARE TT
as select * from session.TT
definition only;

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
zbychu wrote:
Hi
Db2UDB version 8.2
Is possible difrent way than this

DECLARE TT
as select * from session.TT
definition only;

db2 => connect to test;

Database Connection Information

Database server = DB2/NT 8.2.0
SQL authorization ID = SRIELAU
Local database alias = TEST

db2 => declare global temporary table t(c1 int);
DB20000I The SQL command completed successfully.
db2 => describe select * from session.t;

SQLDA Information

sqldaid : SQLDA sqldabc: 896 sqln: 20 sqld: 1

Column Information

sqltype sqllen sqlname.data
sqlname.length
-------------------- ------ ------------------------------
--------------
497 INTEGER 4 C1
2

Will that do?

Cheers
Serge
Nov 12 '05 #2

P: n/a
Thanks ,bat
"
SQL-statement
All executable SQL statements can be contained within the body of
an SQL procedure, with the exception of the following:

* ALTER
* CONNECT
* CREATE any object other than indexes, tables, or views
* DESCRIBE
...
"

Serge Rielau wrote:
zbychu wrote:
Hi
Db2UDB version 8.2
Is possible difrent way than this

DECLARE TT
as select * from session.TT
definition only;

db2 => connect to test;

Database Connection Information

Database server = DB2/NT 8.2.0
SQL authorization ID = SRIELAU
Local database alias = TEST

db2 => declare global temporary table t(c1 int);
DB20000I The SQL command completed successfully.
db2 => describe select * from session.t;

SQLDA Information

sqldaid : SQLDA sqldabc: 896 sqln: 20 sqld: 1

Column Information

sqltype sqllen sqlname.data sqlname.length
-------------------- ------ ------------------------------
--------------
497 INTEGER 4 C1 2

Will that do?

Cheers
Serge


Nov 12 '05 #3

P: n/a
Touche`.
take a look at samples/cli/tbread.C
search for SQLDescribeCol()
Should be easy to masage to what you need.
And then you can post the solution here :-)

Cheers
Serge
Nov 12 '05 #4

P: n/a
Serge Rielau wrote:
Touche`.

Arghh... I misspell even in French :-(
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.