First create solution
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
--select spid,hostname,last_batch,status,program_name
|
||||
--from sysprocesses
|
||||
--where hostname='SISI5SSD1'
|
||||
--order by hostname
|
||||
set nocount on
|
||||
declare @SQLDatabase nvarchar(10)
|
||||
declare @Result nvarchar(max)
|
||||
set @Result='['
|
||||
|
||||
declare CCF cursor local fast_forward for
|
||||
select t1.SQLDatabase
|
||||
from pcs_whs.dbo.CustomersFrom t1
|
||||
where t1.Active=1
|
||||
order by t1.SQLDatabase
|
||||
open CCF
|
||||
fetch next from CCF into @SQLDatabase
|
||||
while @@FETCH_STATUS=0
|
||||
begin
|
||||
if @Result='['
|
||||
begin
|
||||
set @Result+='"'+@SQLDatabase+'"'
|
||||
end
|
||||
else
|
||||
begin
|
||||
set @Result+=',"'+@SQLDatabase+'"'
|
||||
end
|
||||
fetch next from CCF into @SQLDatabase
|
||||
end
|
||||
close CCF
|
||||
deallocate CCF
|
||||
set @Result+=']'
|
||||
|
||||
select @Result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user