Had an issue recently trying to figure out what application was holding a connection open on a SQL server, and here's the lowdown on tracing it down. Firstly, go into a query window and do the following:
sp_who
select spid,hostname,hostprocess from master.dbo.sysprocesses
The 'sp_who' will list the open connections. Look through this list to find any where the ‘dbname’ column is the database you're interested in, and then look for the value in it’s SPID column. The 'sysprocesses' query will give you, for each SPID, the hostname and windows process id (‘hostprocess’) which you can then look up in the task manager on that particular computer.

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

Software Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]
github.com/chrishulbert
linkedin



 Subscribe via RSS