This entry was posted on Monday, May 23rd, 2005 at 11:49 am and is filed under Uncategorized, Tech data. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
This is how to remove users from databases using TSQL. First you must find out what the stored procedure sp_who to find out who is on the system and what their spid is. Query Analyzer:
USE [Database name]
Execute sp_who
this will the list everyone who is on the database along with the spid, it give you some details like login name, it’s status and the command that it is processing from theis you should be able to figure out who is causign problems. Bear in mind that you don’t want to just kill anyone out because that could cause so real problems in the database. Best bet to be careful is try not to kill anything that is owned by the database owner.
then type:
kill [spid]
If you are attempting to detach a database, then it is best to do it through Enterprise Manager because it know exactly which processes are preventing the database from shutting down.