Solved

SQL Server existing connection

Posted on 2009-05-20
6
599 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
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.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now