Results 1 to 12 of 12

Thread: Drop the database through application

  1. #1
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26

    Drop the database through application

    I am trying to drop the database through the application designed using vb.net. Through login form i am logging into the database from the application. There is an option for the user to take the backup and restore the database using the application. I am able to take the backup of the database. To restore the database, i am dropping the existing database. I am unable to drop the database as an error message is being displayed saying that "Cannot drop the database, as it is currently in use". I tried to drop the database even by changing the database names in the connection string.
    But i am unable to drop the database. If any one finds the solution for this please help me. Its very urgent.

    Thanks and Regards,
    sashirekha

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    1. when you restore a database you have to be on master or some other database other than the database that you are restoring.
    2. If some application instance in connected to you database you have to kill them before dropping or restoring the database.
    3. You dont have to drop the database for restoring. you can restore the database with replace command. Same rules 1,2 apply for restoring.

  3. #3
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26
    how to kill the instance before dropping or restoring the database?

    thanks in advance
    sashirekha

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  5. #5
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26
    thanks mak

    we have been struggling with this problem from last 2 months. thought we could not solve it. but with ur valuable reply to our mail we atlast could solve it....thanks a lot from our whole team mates.

    please be in touch . in future if we get any problems kindly help us to solve them.

    thanks and regards
    sashirekha and mohan
    Last edited by sashirekha; 01-05-2006 at 02:18 AM.

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Please feel free to post any questions related to IT here.

    We are here to help people like you and learn from you.

  7. #7
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26
    happy to read ur response.
    stuck up with one more problem.
    clubbing a sql server2000 backup file to an existing sqlserver2000 database. i want to club specific tables only.

    waiting for ur reply

    regards
    sashi and mohan

  8. #8
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Nope. You can't. You have restore the entire database as a different database and then move the tables to the current database.

  9. #9
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26
    we have already done the same procedure, is there any other procedure apart from this.

    for example i have to club 100 tables should i write insert commands for all the tables r else is there any other procedure to club from one database to other like exporting specific tables from one database to another database through T-SQL.

    thanks for helping us.

  10. #10
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Look in BOL for UNION, if you are looking into murge 100 tables to one table.

    You have to do insert using 3 part qualifier [database.owner.object] for clubbing a table in one database to another.

  11. #11
    Join Date
    Jan 2006
    Location
    Hyderabad, India
    Posts
    26
    1. i want to compact my database as my database size is increasing even i drop some columns.

    2. How to insert picture into database column having image data type. We have worked on it but my database size is increasing how to control this.
    i got 16,000 records in a table and my database size has increased upto 35GB. please help us to solve this problem.

  12. #12
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can try SHRINK using DBCC SHRINKDATABASE or rebuild clustered indexes on tables where you have dropped columns.

    How large are image files?. Alternative is to store images in a network share and keep the link in database, it involves more programming to link database rows to image file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •