-- drop all user defined views
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
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
No comments:
Post a Comment