How to find which views are using a certain table in SQL Server (2008)?

Peter picture Peter · Mar 8, 2012 · Viewed 112.1k times · Source

I have to add a few columns to a table and I also need to add these columns to all the views that use this table.

Is it possible to get a list of all the views in a database that use a certain table?

Answer

James Hill picture James Hill · Mar 8, 2012

This should do it:

SELECT * 
FROM   INFORMATION_SCHEMA.VIEWS 
WHERE  VIEW_DEFINITION like '%YourTableName%'