SQL Server existing connection

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????
aatishpatelAsked:
Who is Participating?
 
Raja Jegan RConnect With a Mentor SQL Server DBA & ArchitectCommented:
<< 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
 
Aneesh RetnakaranDatabase AdministratorCommented:
run sp_who2  and kill the spids against that database

KILL()
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
aatishpatelAuthor Commented:
any other step
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
there is no otherway todo from the server side
0
 
aatishpatelAuthor Commented:
thanx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.