can not drop user from database

I'm getting the can't drop user error. Is there a way to change the schema owner via smo I've tried the following code to change the schema owner back to a different user. I don't get an error or exception but the schema owner doesn't change.

Database database = new Server("my server").Databases["my Database"];

database.Schemas["db_owner"].Owner = "db_owner";



Answer this question

can not drop user from database

  • Srinivasa D Parupalli

    John, giving that your question is SMO related, I split it from the thread you posted it in and I moved it to the SMO forum.

    Thanks
    Laurentiu



  • Mosquito

    Never mind, the following worked.

    Database database = new Server("my server").Databases["my Database"];

    database.Schemas["db_owner"].Owner = "db_owner";

    database.Schemas["db_owner"].Alter();


  • can not drop user from database