Hi, thanks for this one!
Mnd goal is to publish a content database from staging to live, safely, from an admin web page. The wrinkle is that the DB must remain alive on the web during the process ... I plan to modify the DSNs on the fly.
One small point, when I use this in SQL 7 it returns an error "You can't kill your own process."
This error was causing the calling DTS package to fail on this step.
I simply added a clause to the SELECT of spids to exclude "@@SPID" which is the current process.
SELECT spid
FROM master.dbo.sysprocesses
WHERE dbid =
(SELECT dbid FROM master.dbo.sysdatabases
WHERE name = @DatabaseName)
AND spid <> @@SPID
^^^^^^^^^^^^^
It worked fine and once again I appreciate the resource, I don't know much T-SQL ... I'm actually a web guy using Cold Fusion with SQL Server.
- Jon