Jump to content

Disconnect MS SQLSerever2008 idle users/connections


Recommended Posts

Your question is more related to databases not AutoIt. Anyway, you can use any AutoIt UDF for SQL to call a script like this one:

SELECT *
FROM sys.sysprocesses
where status IN ('sleeping')
and cmd IN ('AWAITING COMMAND')
and kpid = 0
and spid > 50
and db_name(dbid) not in ('master','tempdb','model','msdb')
and datediff(mi,last_batch,getdate()) > 10

Make a cursor and kill each session.

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...