توسط دستور زیر میتوان لیست تمامی Schemaهای موجود در یک دیتابیس شامل شماهای پیش فرض و سیستمی (db_* ,sys,information_schema وguest) را بدست آورد.
select s.name as schema_name, s.schema_id, u.name as schema_owner from sys.schemas s inner join sys.sysusers u on u.uid = s.principal_id order by s.name
Schema_name: نام شِما
Schema_id :Id مربوط به شِما . این شماره در هر Instance , Unique می باشد
Schema_owner: نام شِمای مالک ؟؟؟؟؟
یک نمونه از اجرای دستور بالا:
دانلود این اسکریپت