Discussion Locked

SQL Database users

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Is there a way to find out who is currently accessesing a SQL 7.0 database. I need to detach a database and when I try to do that I get an error message stating that the file is in use. Any ideas on how to find out who is using the database?

5 replies

by joseph moore

Open up Enterprise Manager.
Expand the Server Group, then the SQL Server in question, then Management, then Current Activity, then Locks/Process ID.
YOu will get a list of SPIDs (the IDs that are assigned to each connection to SQL Server). Click each one, and look in the right pane to see which database each one is connected to.
There is an Owner column that (I think) will list the SQL Server Login account that has that SPID assigned to it.
You can Kill any SPID connection by right-clicking on the connection, going to Properties, then choosing Kill.

hope this helps

by hpw3

You can also use the sp_who command in T-SQL. If you are still getting the file is in use error, you might want to check the 'jobs' in Ent Manager to make sure none are currently running.

This discussion is closed to new replies.