September 4, 2013 at 9:40 am
Hello Everyone
Is there a way to kill SPIDs in a certain SPID range? like all spids 75-100 etc... Or with a date range? Say all SPIDs that are over a day old? I am seeing some stale connections that are not closing.
Thanks
Andrew SQLDBA
September 4, 2013 at 10:07 am
I would create a simple function or just throw the results into a parameter table and loop through the spids, executing a kill command for each (you could also use a cursor). you could play with the query below to ensure you only get the spids you truly want to KILL...
SELECT spid FROM sys. sysprocesses P
JOIN sys .sysdatabases D ON (D .dbid = P. dbid)
WHERE LTRIM (RTRIM( D.Name )) = @dbname
AND P. spid != @@SPID
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy