Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @dbname nvarchar(128)
- declare @dynamic_command nvarchar(1024)
- set @dynamic_command = null
- declare resume_cursor cursor for
- select 'ALTER DATABASE [' + name +'] SET HADR RESUME;' from sys.databases where group_database_id is not null
- open resume_cursor
- fetch next from resume_cursor into @dbname
- while @@fetch_status = 0
- begin
- set @dynamic_command = @dbname
- exec sp_executesql @dynamic_command
- set @dynamic_command = null
- fetch next from resume_cursor into @dbname
- end
- close resume_cursor
- deallocate resume_cursor
Add Comment
Please, Sign In to add comment