<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>kill connection Archives - IT Blog Site</title>
	<atom:link href="https://www.lavatelli.it/tag/kill-connection/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lavatelli.it/tag/kill-connection/</link>
	<description>Lavatelli IT Blog Site</description>
	<lastBuildDate>Thu, 16 Jan 2014 13:45:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://www.lavatelli.it/wp-content/uploads/2019/02/ice_dragon-150x145.gif</url>
	<title>kill connection Archives - IT Blog Site</title>
	<link>https://www.lavatelli.it/tag/kill-connection/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to kill all connections to a SQL Server DB</title>
		<link>https://www.lavatelli.it/how-do-you-kill-all-current-connections-to-a-sql-server-database/</link>
		
		<dc:creator><![CDATA[Franz]]></dc:creator>
		<pubDate>Thu, 16 Jan 2014 13:45:01 +0000</pubDate>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[kill connection]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sql kill database]]></category>
		<category><![CDATA[sql server]]></category>
		<guid isPermaLink="false">http://www.lavatelli.it/?p=302</guid>

					<description><![CDATA[<p>Script to accomplish this, replace &#8216;DB_NAME&#8217; with the database to kill all connections to: USE master GO SET NOCOUNT ON DECLARE @DBName varchar(50) DECLARE @spidstr varchar(8000) DECLARE @ConnKilled smallint SET @ConnKilled=0 SET @spidstr = '' Set @DBName = 'DB_NAME' IF db_id(@DBName) &#60; 4 BEGIN PRINT 'Connections to system databases cannot be killed' RETURN END SELECT ...</p>
<p>The post <a href="https://www.lavatelli.it/how-do-you-kill-all-current-connections-to-a-sql-server-database/">How to kill all connections to a SQL Server DB</a> appeared first on <a href="https://www.lavatelli.it">IT Blog Site</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="entry">
<p>Script to accomplish this, replace &#8216;DB_NAME&#8217; with the database to kill all connections to:</p>
<pre><code>USE master
GO

SET NOCOUNT ON
DECLARE @DBName varchar(50)
DECLARE @spidstr varchar(8000)
DECLARE @ConnKilled smallint
SET @ConnKilled=0
SET @spidstr = ''

Set @DBName = 'DB_NAME'
IF db_id(@DBName) &lt; 4
BEGIN
PRINT 'Connections to system databases cannot be killed'
RETURN
END
SELECT @spidstr=coalesce(@spidstr,',' )+'kill '+convert(varchar, spid)+ '; '
FROM master..sysprocesses WHERE dbid=db_id(@DBName)

IF LEN(@spidstr) &gt; 0
BEGIN
EXEC(@spidstr)
SELECT @ConnKilled = COUNT(1)
FROM master..sysprocesses WHERE dbid=db_id(@DBName)
END</code></pre>
</div>
<p><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&amp;linkname=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&amp;linkname=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&amp;linkname=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&amp;linkname=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&amp;linkname=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.lavatelli.it%2Fhow-do-you-kill-all-current-connections-to-a-sql-server-database%2F&#038;title=How%20to%20kill%20all%20connections%20to%20a%20SQL%20Server%20DB" data-a2a-url="https://www.lavatelli.it/how-do-you-kill-all-current-connections-to-a-sql-server-database/" data-a2a-title="How to kill all connections to a SQL Server DB"></a></p><p>The post <a href="https://www.lavatelli.it/how-do-you-kill-all-current-connections-to-a-sql-server-database/">How to kill all connections to a SQL Server DB</a> appeared first on <a href="https://www.lavatelli.it">IT Blog Site</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 59/51 objects using Redis
Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Redis

Served from: www.lavatelli.it @ 2026-11-28 20:14:53 by W3 Total Cache
-->