View previous topic :: View next topic
|
Author |
Message |
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
Hi,
Could someone tell the query to find count of columns in a table.
Like in ORACLE there is something call DESC <table_name>
For Ex.
SELECT * FROM SYSIBM.SYSPLAN;
How can we find out as to how many columns above query will fetch?
Regards,
N |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
Back to top |
|
|
cmsmoon
New User
Joined: 17 Jun 2010 Posts: 75 Location: Chennai
|
|
|
|
Hi ,
You can use the below query to get no of columns in a table.
SELECT COUNT(NAME)
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = 'table name'
AND TBCREATOR = 'table qualifier'; |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
though the link was bad for Gnana Sekaan Nallathambi's post
the systables route seems to be a better piece of sql than
yours cmsmoon.
his is a one row, one column fetch,
yours is a multirow fetch with a scalar function.
by the way, the term fetch is used as is by ibm when referring to row retrieval,
not a cursor. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
Back to top |
|
|
|