Tag Archives: database

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'

SQL Server Check User Permissions

Another quick solution for users of MSSQL Server. fn_my_permissions and results

To view the permissions the current logged SQL user has, use the command

SELECT * FROM fn_my_permissions(NULL, 'DATABASE')

or variations to return a list of SQL commands permitted.

For more details, visit the MSDN page