You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Thiwanka Somasiri <as...@gmail.com> on 2010/05/26 08:09:16 UTC
How to count the number of columns in a table.
Hi,
How can I count the number of columns in a table using an "ij"
command?
Thanks.
--
Regards
A.S.Thiwanka Somasiri
Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
Skype : executionerwild
MSN : thiwas@ymail.com
Re: How to count the number of columns in a table.
Posted by Bryan Pendleton <bp...@gmail.com>.
> How can I count the number of columns in a table using an "ij"
You could query the system catalogs. Something like:
select count(*) from SYS.SYSTABLES, SYS.SYSCOLUMNS
where SYS.SYSTABLES.TABLEID=SYS.SYSCOLUMNS.REFERENCEID
and SYS.SYSTABLES.TABLENAME = 'MY-TABLE-NAME';
thanks,
bryan