Please allow feedback on "Script of the Day"

  • Allow feedback on the "Script of the Day".

    In particular, the one for 11/23 -- "Kill Connections to Specific Database" -- is a poor method of doing that function.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • Kill connections is pretty good.

    but if you think 'kill connections' is bad...

    check out the 'database growth details" the code for today, 28-nov-2006.  it is "Spaghetti-that-the-baby-threw-up" code.

    sorry to the coder of DGD.

     

  • It's on the list. We'll get it done.

  • > Kill connections is pretty good. <

    No, it's not - ALTER DATABASE should be used.

    And if you really want  to issue specific KILLs, you can do it something like this:

    DECLARE @sql VARCHAR(8000)

    SET @sql = ''

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

    FROM sysprocesses WITH (NOLOCK)

    WHERE spid > 50 AND DB_NAME(dbid) = N'databaseName'

    EXEC(@sql)

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • IN COMPARISON TO TODAY's SCRIPT.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply