Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get table info when only table name is known.

Status
Not open for further replies.

KJS2002

Programmer
Jul 15, 2002
11
0
0
GB
I'm trying to query a table and get back 'something' from which I can extract the table's column names and types.

At the moment I'm using meta data (Java) but need at least one record in my ResultSet to be able to get the meta data in the first place.

So...
1. How can I select just one record from a table without knowing any details about that table or any records in it? (something like 'SELECT TOP 1' for MS SQL Server)

Or/and...
2. Is it possible to get table information without retrieving a record (what if the table is empty for example?).

Thanks.
 
or if you must select something:
SELECT * FROM <tablename> limit 1

will return just 1 row of data. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
&quot;describe <tablename>&quot; is equal to:
&quot;show columns from <tablename>&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top