Exclude Views in INFORMATION_SCHEMA

Another quick tip.
Selecting from INFORMATION_SCHEMA.COLUMNS unfortunately returns also every column in views on top of tables. I never use views and definitely don’t need those columns.

To filter them out, use:

SELECT * FROM INFORMATION_SCHEMA.COLUMNS c
JOING INFORMATION.TABLES t ON c.TABLE_NAME = t.TABLE_NAME
AND t.TABLE_TYPE = 'BASE TABLE'

Related posts:

  1. .NET Compare 2 Datarows by Value Using LINQ
  2. ABAP Get Columns of a Table with Includes in Structure
  3. SQL Server Check User Permissions
  4. DataGridView Change Cell Data Type After Binding