http://www.sqlservercentral.com/blogs/dugi/2008/07/15/find-all-views-created-on-a-table/

Printed 2014/11/27 06:36PM

Find all views created on a table

By Dukagjin Maloku, 2008/07/15

USE ADVENTUREWORKS; -- You can use any kind of database that you have
GO

--Procedure that shows all views created on a table, together with schema

CREATE PROCEDURE VIEWS_IN_TABLE
@TABLENAME
VARCHAR(200)
AS
SELECT
VIEW_SCHEMA, VIEW_NAME FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
WHERE TABLE_NAME = @TABLENAME;
GO

--executing the procedure with parameter value
EXEC VIEWS_IN_TABLE
ADDRESS

--n'joy the results!

--Dugi

 


Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.