|
-
SQL question
is there any SQL command that can return a column name?
like if tables have 4 columns: ID, name, price, qty
i need a function/sql statement that can return those strings (column name) but i never seen this before...
so does it exist in sql?
thanks
Help!!! I'm swimming with the sharks...!!
-
Ursus Arctos Moderatis
This depends on what DBMS you're using. For example, I know under Oracle, you can simply say "desc <tablename>" and it will spit out the table structure for you.
I've always been curious if MySQL had some equivilent to that...but I haven't found it.
What exactly are you trying to accomplish?
-
Reef Shark
MySQL has:
describe <tablename>
which also outputs the table info.
-
Hammerhead Shark
MS SQL has quite a few options as well, you can try this
SELECT a.name
FROM syscolumns a
JOIN sysobjects b
ON a.id = b.id
WHERE b.name = '<tablename>'
AND b.type = 'U'
This will give you a list of all the columns in a table.
Last edited by krack_it_up; 02-20-2002 at 08:30 PM.
MMMMMMMMMM...... BAR-B-Q
-- Homer Simpson
-
i'm using Access database and VB for the program
Help!!! I'm swimming with the sharks...!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|