Solved

SQL Server existing connection

Posted on 2009-05-20
6
607 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

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 …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

749 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