Procedure to check Views defined for the table


Below is the Procedure for checking the views that are defined for the table.

–Creating the procedure:

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

–Testing the procedure

EXEC VIEWS_IN_TABLE

ADDRESS;

GO

Regards,

Chaitanya,

Webiste : https://mssqlbuzz.wordpress.com/

To Send Mail : mssqlbuzz

Leave a comment

Design a site like this with WordPress.com
Get started