Solved

SQL Server existing connection

Posted on 2009-05-20
6
602 Views
Last Modified: 2012-05-07
how do i close existing connection on a database.

actually i was trying to delete the database but it says database is in use. so need to close existing connectioin first. so how do i do that????
0
Comment
Question by:aatishpatel
  • 2
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24431423
run sp_who2  and kill the spids against that database

KILL()
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24431470
No.. You cannot close your existing connection and No need to close existing connection to delete the database.

You can run either sp_who or sp_who2 and find list of spid >50

Kill all those ids iteratively like

kill 51

Hope this helps
0
 

Author Comment

by:aatishpatel
ID: 24431524
any other step
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24431549
there is no otherway todo from the server side
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 24431582
<< how do i close existing connection on a database. >>

Do all steps mentioned above.
Close the existing connection by closing that query window opened. (Commit / Rollback if Implicit transactions is set to ON)
And in Enterprise manager or SSMS, Right Click and Delete the database.
0
 

Author Closing Comment

by:aatishpatel
ID: 31583494
thanx
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Generate Scripts Fails 5 35
Loop to go backward 90 days 2 18
Attaching Database Failed ? 3 40
SQL Server Import/Error Wizard error 12 15
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question