Hi,
What is SQL statement for showing all columns of database table?
Thanks.
SQL command for showing columns
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dhaval PatelRank #1,023 · 1.9K reputationPosted Jan 17, 2012, 7:32 PM EST
For all column of database table use this query
SELECT Table_Name, Column_Name, Data_Type,
Is_Nullable FROM information_schema.columns WHERE table_name IN
(SELECT name FROM sysobjects WHERE xtype='U') ORDER BY table_name
Thanks & Regards
Dhaval Patel
Datta KharadRank #2,135 · 668 reputationPosted Jan 17, 2012, 8:10 PM EST
Showing all columns of databse table:-
If you own the table:
select column_name from user_tab_columns
where table_name = 'YOUR TABLE NAME HERE';
If you don't own the table but were granted access to it:
select column_name from all_tab_columns
where owner = 'TABLE OWNER HERE'
and table_name = 'YOUR TABLE NAME HERE';
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 17, 2012, 10:01 PM EST
Try this..
select c.name [Column Name],o.name [Table Name] from sys.all_columns c,
sys.objects o
where o.object_id = c.object_id and o.type='U'
hope this help.