--STORE PROCEDURE TO REMOVE ALL Connected Database users
CREATE PROCEDURE dbo.clearDBUsers
@dbName SYSNAME
AS
BEGIN
SET NOCOUNT ON
DECLARE @spid INT,
@cnt INT,
@sql VARCHAR(255)
SELECT @spid = MIN(spid), @cnt = COUNT(*)
FROM master..sysprocesses
WHERE dbid = DB_ID(@dbname)
AND spid != @@SPID
PRINT 'Starting to KILL '+RTRIM(@cnt)+' processes.'
WHILE @spid IS NOT NULL
BEGIN
PRINT 'About to KILL '+RTRIM(@spid)
SET @sql = 'KILL '+RTRIM(@spid)
EXEC(@sql)
SELECT @spid = MIN(spid), @cnt = COUNT(*)
FROM master..sysprocesses
WHERE dbid = DB_ID(@dbname)
AND spid != @@SPID
PRINT RTRIM(@cnt)+' processes remain.'
END
END
GO
2 comments:
Hi abbas on what tools and technologies do you work in Systems, do you work in VB 6.0 in Systems and on what tools were you working in 360 degreez,on what technologies have you worked professionally.
I work on Cognos/Crystal Reports/SQL Server 2K/SQL Server 2K5/Adobe Live Cycle Designer in Systems Limited.
I worked on VB/SQL Server/Crystal Report in TSDZ.
Post a Comment