>Hi,
>
>I'm in the process of writing a program that will automate the SQL Detach command so that I may copy their database to my system. My problem is that the Detach command will fail if there is users using it, for pretty obvious reasons, so I would like to know when the number of connections to the database is zero.
>
>Perhaps there is another way.
>
>
>TIA
>
>Peter
I have a sample that does that, however, I don't have it here with me. Drop me an email and/or I will post it tonight. I'm pretty sure it uses SQL-DMO, but can't for the life of me remember how I set it up.
Also, check out the
sp_who system stored proc in the BOL. That SP will tell you who's connected to what.
Dan LeClair
www.cyberwombat.comSET RANT ON - The Wombat BlogLife isn’t a morality contest and purity makes a poor shield. - J. Peter MulhernDisclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.