A bit about

Hello, everyone! All you can see below is just my bank of information. Some material I've found in the fathomless net, some I've learned myself. Don't think all of the information here is right or actual, but may be it could be of use for you :) All feedback is welcome, especially constructive ones :)

Thursday, October 15, 2009

MS SQL: Drop view if it exists

Microsoft recommends the following way of dropping database view without an error message if the view doesn't exist (http://msdn.microsoft.com/en-us/library/aa258835%28SQL.80%29.aspx):
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'View_myview')
DROP VIEW dbo.View_myview
GO

0 comments:

Post a Comment