|
http://community.csdn.net/Expert/topic/5227/5227882.xml?temp=.1036341
--Prohibit profiler
if exists(select * from master.dbo.sysprocesses
where program_name=N'SQL Profiler')
begin
declare tb cursor local for
select'kill'+rtrim(spid) from master.dbo.sysprocesses
where program_name=N'SQL Profiler'
declare @s nvarchar(100)
open tb fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb
end
else
print'SQL Profiler is not enabled' |
|