Results 1 to 6 of 6

Thread: Drop User with Msg 15138?

  1. #1
    Join Date
    Mar 2003
    Posts
    383

    Drop User with Msg 15138?

    Hi: I try to drop a user with following error
    drop user TestUser
    Msg 15138, Level 16, State 1, Line 1
    The database principal owns a schema in the database, and cannot be dropped.

    Then I tried:
    select * from information_schema.schemata
    where schema_owner = 'TestUser'
    CATALOG_NAME SCHEMA_NAME SCHEMA_OWNER
    ---------------- ------------- ------------
    DB_Installation db_datareader TestUser
    (1 row(s) affected)

    Drop schema TestUser
    Msg 15151, Level 16, State 1, Line 1
    Cannot drop the schema 'TestUser', because it does not exist or you do not have permission.

    any idea?
    thanks
    -D

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Change schema owner to other db user then drop TestUser.

  3. #3
    Join Date
    Mar 2003
    Posts
    383
    Hi Rmiao:

    Can I change the schema owner with t-sql? or a system proc?

    I guess system tables since SQL 2005 coming out, could not be modified directly?

    thanks lot for your help.
    -D

  4. #4
    Join Date
    Mar 2003
    Posts
    383
    I want to change the schema_owner from TestUser to dbo.

    I have tried use
    Alter authorization on object::db_datareader to schema owner

    it failed.

    thanks
    -D

  5. #5
    Join Date
    Sep 2002
    Posts
    5,938
    Try this:

    Alter authorization on schema::db_datareader to dbo

  6. #6
    Join Date
    Mar 2003
    Posts
    383
    Hi Rmiao:

    It works!

    thanks for your help.
    -D

Posting Permissions

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