How can I tell if a schema is being used?

  • We have some user-defined schemas in our dev environment that have, unfortunately, made it over to our production environment. I say it's unfortunate because I believe they were created by mistake and are not being used.

    Is there an easy way to tell if a schema is being used?

    Sorry if this is a noob question, but I haven't dealt much with defining schemas and I want to get our DB cleaned up. Thanks!

  • this should give you all unused schemas

    select b.name from sys.objects a

    right outer join sys.schemas b

    on a.schema_id = b.schema_id

    where a.name is null

    and b.schema_id > 4

    and b.schema_id < 16384

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

  • Perfect! Thanks!

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

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