Showing posts with label View. Show all posts
Showing posts with label View. Show all posts

Monday, June 14, 2010

Check and drop existing view in SQL database

Check if view exists in SQL server database and drop it if required.

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[TBL_View]') AND OBJECTPROPERTY(id, N'IsView') = 1)

BEGIN

DROP VIEW [dbo].[TBL_View]

END