Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Adding a trigger to sysprocesses

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-30 : 09:31:16
Yannick writes "
Hi SQL Guru !

We are trying to know when a user( an application ) abruptely disconnects from a database. To do this we tried to add a trigger for delete on sysprocesses. BUT, event with sa, we do not have the permission. Is there (another) way to be notified when a user disconnects from a database ?

Environment: Win NT4, Win 2000, SQL 7 SP2, SQL2K SP1.


Thank you in advance !"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-11-30 : 09:49:41
If I remember correctly, you can't put triggers on system tables, and even if you can, it is A VERY BAD IDEA. Modifying system tables is a great way to completely FUBAR your SQL Server. Don't do it.

May I ask why you need to know if a user suddenly drops a connection, vs. intentionally disconnecting? I don't know if sysprocesses will have that kind of information.

Search the SQL Team forums for "disconnect", I remember a similar question not too long ago, I think there was an answer there (a system stored procedure or something).

Go to Top of Page

Yannick
Starting Member

2 Posts

Posted - 2001-11-30 : 10:19:42
It is because we manage our own "logical" locking system. So if a connection drops, we will remove it's identification in the lock table if this has not already been done by the application ( when it finishes ok).
The search for "disconnect" did not return any information on this topic, I will continue looking for another solution. In fact I have another solution ( run a sp on a regular basis to clean the lock table ), but I do not like it ;-)

Thank's

Yannick.
Go to Top of Page

Yannick
Starting Member

2 Posts

Posted - 2001-11-30 : 10:33:50
OK found it ( the article you were writing about ) : TOPIC_ID=3541

I did the search with "sysprocesses".

BUT no other solution in view...



Edited by - Yannick on 11/30/2001 10:34:10
Go to Top of Page
   

- Advertisement -