Ativa ENABLE_BROKER no SQL Server

declare @db varchar(100)

SELECT top 1 @db = Name
FROM sys.databases
WHERE Name like 'ERP%'
and is_broker_enabled = 0

select @db

USE [master];

DECLARE @kill varchar(8000) = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE database_id = db_id(@db)

EXEC(@kill);

set @kill = 'ALTER DATABASE '+@db+' SET NEW_BROKER; ALTER DATABASE '+@db+' SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE; '
exec(@kill)

Alguma dúvida?
Abrir chamado