Remove Schema / Remove Database User

  • Hi. I ran

    sp_helprotect NULL, NULL, NULL, 'o'

    against a database. This returned 158 rows. The owner against each object was either 'dbo' or 'sys'.

    I am trying to identify which objects (if any) are owned by a specific Schema?

    I have a database that has 'User A' with a Schema of the same name. I am pretty sure the User account was create but never used for anything.

    I want to be 100% sure before removing the Schema then the User.

    Any advice?

    Many Thanks,

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

  • you can run this:

    select

    s.name

    object_id,

    o.name,

    o.type

    from sys.sysobjects o join sys.schemas s

    on o.uid = s.schema_id

    where s.name =

  • Thanks for that. It returned 0 rows so I guess I am safe to remove (as I thought). Best to check.

    Many Thanks,

    Phil.

    -------------------------------------------------------------------------------------
    A neutron walks into a bar. "I'd like a beer" he says. The bartender promptly serves up a beer. "How much will that be?" asks the neutron. "For you?" replies the bartender, "no charge."

    Two hydrogen atoms walk into a bar. One says, 'I think I've lost an electron.' The other says 'Are you sure?' The first says, 'Yes, I'm positive... '

    Tommy Cooper

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply