Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. deleting an sql database

deleting an sql database

Scheduled Pinned Locked Moved Database
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Keshav V Kamat 0
    wrote on last edited by
    #1

    how to delete a sql database. it contains a single table. I have tried dropping the table first. the table is deleted, still i get an exception saying the database is being used. thanks in advance.

    Keshav Kamat :) India

    K H 2 Replies Last reply
    0
    • K Keshav V Kamat 0

      how to delete a sql database. it contains a single table. I have tried dropping the table first. the table is deleted, still i get an exception saying the database is being used. thanks in advance.

      Keshav Kamat :) India

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      Close all applications that are accessin the database and then delete. or Stop & Start SQL Server, will close all open connections Cannot drop a database currently in use i.e. open for reading or writing by any user

      Regards KP

      1 Reply Last reply
      0
      • K Keshav V Kamat 0

        how to delete a sql database. it contains a single table. I have tried dropping the table first. the table is deleted, still i get an exception saying the database is being used. thanks in advance.

        Keshav Kamat :) India

        H Offline
        H Offline
        Hayder Marzouk
        wrote on last edited by
        #3

        Hi, When u cannot delete a database that means that a connection to the database is still alive. - If u want to delete it from SQL Server Entreprise manager, do the following : 1- Right click on the database 2- Choose All tasks \ Detach database 3- U can see the number of connections to the database. Click on the Clear button to force open connections to disconnect. 4- Do not detach the database but click on cancel and now u can delete the database. - If u are deleting the database from SQL Query Analyzer be sure to be not connected on the database to delete. Choose the master database in the combobox. To delete the database just execute the query : Drop database YourDatabase. - If ure using .net to delete the database. U must turn off Pooling in your connection strings. That's because even u close all connections by using Connection.Close() method, connections still open for performance reasons. HTH.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups