locked
Dropping a database from ASP.NET RRS feed

  • Question

  • I am trying to run a dymanic DROP DATABASE <dbname> command in a stored procedure called from ASP.NET. I typically connect from the .net using a SQL builtin account.  I am getting this error:

     

    System.Data.SqlClient.SqlException: Cannot drop the database 'db_testco', because it does not exist or you do not have permission.

     

    The database is there for sure asI can browse it via the Studio manager.  What permission do I need to set for my .net login to allow it to drop ?  I tried adding the Delete permission to the database and still no go...

     

    Setup: SQL 2005 SP2 2 Node cluster.

     

    Thanks.

    Wednesday, January 16, 2008 1:13 AM

Answers

  •  

    From BOL

     

    To execute DROP DATABASE, at a minimum, a user must have CONTROL permission on the database.

     

    Wednesday, January 16, 2008 7:11 AM

All replies

  •  

    From BOL

     

    To execute DROP DATABASE, at a minimum, a user must have CONTROL permission on the database.

     

    Wednesday, January 16, 2008 7:11 AM
  • Also, make sure that you are connected to "master" database before issuing the DROP DATABASE command.
    Wednesday, January 16, 2008 4:14 PM