Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select Columns of a View

I'm attempting to select the column names of a view in a similar way as selecting from information_schema.columns.

I can't seem to find a way to do this. Has anyone else done this before or know if it is even possible?

like image 687
steventnorris Avatar asked Jun 29 '12 20:06

steventnorris


People also ask

How can I see the column names in a SQL view?

The following query will give the table's column names: SELECT column_name FROM INFORMATION_SCHEMA. COLUMNS. WHERE TABLE_NAME = 'News'


1 Answers

information_schema.columns.Table_name (at least under Sql Server 2000) includes views, so just use

SELECT * FROM information_schema.columns WHERE table_name = 'VIEW_NAME' 
like image 52
Ghost Avatar answered Sep 28 '22 04:09

Ghost