Re: End SQL Session (SQL Server)



Jhon (Jhon@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I'm System Administrator and I have an special login with permision over
a DB in Productive. We have an support team. When they need to correct
any data in DB, they request the special login in order to change the
data directly in DB. When I give them the special login, if they don't
close the session, they can use it whenever they want. I need to close
the special login in order to they have to request it again.

How do they get the special login? Do you log in with username and password
and then leave them alone on that computer?

You could have a job that runs from SQL Server Agent and which runs a cursor
over

SELECT 'KILL ' + ltrim(str(spid))
FROM sysprocesses
WHERE loginame = 'speciallogin'
AND datediff(MINUTE, login_time, getdate()) > 30

and then uses EXEC() to run these KILL commands. This is somewhat heavy-
handed. You could improve it by adding last_batch to the mix. For instance
if no batch have been submitted for the last ten minutes, kill the
connection.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Trying to get Mgmt Studio to work as expected
    ... when it comes from a SQL Server MVP, ... I found that there already is a request for this: ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: How to connect to sql server from dotnet
    ... Request for the permission of type ... signed assemblies or somesuch and not a problem with SQL Server per se. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: How to connect to sql server from dotnet
    ... Request for the permission of type ... signed assemblies or somesuch and not a problem with SQL Server per se. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Dynamic date range for each row?
    ... only support partitioning by a column. ... There is a request on ORDER BY for aggregates on Connect: ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)