Introduction:
In this
article i will explain how to delete all the views from Sql server database.
We can delete all views by executing single query.
We don’t need to execute different query for each View.
Note: This command will delete
all the views from your database.
Implementation: In Sql server execute the following command:
Implementation: In Sql server execute the following command:
Declare @viewName varchar(500)
Declare cur Cursor For Select [name] From sys.objects where
type = 'v'
Open cur
Fetch Next From cur Into @viewName
While @@fetch_status = 0
Begin
Exec('drop view ' + @viewName)
Fetch Next From cur Into @viewName
End
Close cur
Deallocate cur
0 comments:
Post a Comment