Skip to content

Instantly share code, notes, and snippets.

@rofr
Created November 28, 2012 16:29
Show Gist options
  • Save rofr/4162362 to your computer and use it in GitHub Desktop.
Save rofr/4162362 to your computer and use it in GitHub Desktop.
Sql Server Object Explorer in VS12
/*
* The Sql Server Object Explorer Window of Visual Studio 2012
* doesn't release connections properly. Here is a workaround
*
*/
-- 1. Open a query window, either VS or SSMS will do
-- 2. Run the following select, replacing 'MyDB' with the name of your DB
select session_id from sys.dm_exec_sessions
where program_name = 'Microsoft SQL Server Data Tools, Online Properties'
and database_id = db_id('MyDB')
/* Results
session_id
----------
54
(1 row(s) affected)
*/
-- 3. Kill the session id!
KILL 54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment