Hi,
What is SQL statement for showing all columns of database table?
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jan 18, 2012, 3:01 AM
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.
Datta KharadPosted Jan 18, 2012, 1:10 AM
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';
Dhaval PatelPosted Jan 18, 2012, 12:32 AM
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