Kind of klugy, but it works... Using perl or php, do a fetchrow on a table. With any query, i.e. select * from table. Now assign @row to a scalar variable. This will give you the length of the array. The length is the number of columns.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 3:18 PM To: Monet Cc: mysql Subject: Re: how to count columns in SQL? AFAIK, exposing the database schema tables/views is on the todo list for 5.x. Until then you will have to count the # of rows that comes back from describe table. Shawn Green Database Administrator Unimin Corporation - Spruce Pine Monet <[EMAIL PROTECTED]> wrote on 09/16/2004 03:50:55 PM: > Hi, everyone, > > I have a sql question here, please don't ignore it and > help please. > > I know one can use "describe table" in mysql to get > number of columns. Is there any way to do so in SQL? I > have some tables on SQL sever 2000. I use Access 2000 > Link table function to link to the server. And I want > to count columns not rows since I want to know how > many fields in a table. > > Any advise? Thanks. > Monet > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail is new and improved - Check it out! > http://promotions.yahoo.com/new_mail > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]