Solved

SQL Server existing connection

Posted on 2009-05-20
6
596 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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ms sql stored procedure 22 77
SQL Server issue connecting to named instance 6 43
Stored procedure 23 24
Stored Procedure 2 0
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

747 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

8 Experts available now in Live!

Get 1:1 Help Now