I have a script that I use to see if someone has been logged in for too long. Does anyone know how to take a varible spid and kill that login. I tried using kill @spid, but that does not work. Any Suggestions?
Printable View
I have a script that I use to see if someone has been logged in for too long. Does anyone know how to take a varible spid and kill that login. I tried using kill @spid, but that does not work. Any Suggestions?
Try this:
declare @t char(2)
declare @c char(20)
set @t = 55
set @c = 'kill ' + @t
exec (@c)