Ok,

 

I’m talking to myself I know, here’s the solution if anyone cares.

 

Andrew, your pointer got me looking in a different direction that found this.

 

<cfquery name="query" datasource="master">

      IF  EXISTS(SELECT * FROM sysdatabases WHERE name='#arguments.stack#') BEGIN

            DECLARE @db NVARCHAR(50)

            SET @db = N'#arguments.stack#'

                       

            DECLARE @sql VARCHAR(8000)

            SET @sql = ''

            SELECT @sql = @sql + 'KILL ' + CAST(spid AS VARCHAR(6)) + ' '

            FROM master..sysprocesses

            WHERE DB_NAME(dbid) = @db AND spid > 6

            --PRINT 'Kill cmd = ' + @sql

            EXEC (@sql)

            DROP DATABASE #arguments.stack#;

      END

</cfquery>

Regards
Dale Fraser


From: [email protected] [mailto:[email protected]] On Behalf Of Dale Fraser
Sent: Wednesday, 5 July 2006 16:14 PM
To: [email protected]
Subject: [cfaussie] Re: OT: DROP Database

 

Andrew,

 

I did a bit of a search and there is a SP sp_who2 which lists all the processes, including what DB’s

 

So I could loop through that and then issue a kill on all the relevant processes.

 

I thought there might be an easier way, like a force option on DROP or a CLEAR command.

Regards
Dale Fraser


From: [email protected] [mailto:[email protected]] On Behalf Of Andrew Scott
Sent: Wednesday, 5 July 2006 15:56 PM
To: [email protected]
Subject: [cfaussie] Re: OT: DROP Database

 

Dale,

 

Wouldn’t a SP work then call that via CF?

 

 

Senior Coldfusion Developer

Aegeon Pty. Ltd.

www.aegeon.com.au

Phone: +613  8676 4223

Mobile: 0404 998 273

 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---




Reply via email to