IS_MEMBER (Transact-SQL)
Geçerli kullanıcının olup olmadığını gösterir bir üye, belirtilen Microsoft Windows, Grup veya SQL Server veritabanı rolü.
IS_MEMBER ( { 'group' | 'role' } )
Bağımsız değişkenler
'group'
Is the name of the Windows group that is being checked; must be in the format Domain\Group.group is sysname.'role'
Is the name of the SQL Server role that is being checked.role is sysname and can include the database fixed roles or user-defined roles, but not server roles.
Dönüş Türleri
int
Remarks
IS_MEMBER aşağıdaki değerleri döndürür.
Dönüş değeri |
Açıklama |
---|---|
0 |
Geçerli bir kullanıcı bir üye, group veya role. |
1 |
Geçerli bir kullanıcı bir üye, group veya role. |
null |
Her iki group veya role geçerli değil. Tarafından sorgulanan, bir SQL Server oturum açma veya uygulama rolü kullanarak bir oturumu için bir Windows grubu NULL döndürüyor. |
IS_MEMBER, Windows tarafından oluşturulan bir erişim belirtecine incelenerek Windows grup üyeliklerini belirler.Erişim simgesi kullanıcının bağlandığı sonrasında yapılan grup üyeliği değişiklikleri yansıtacak bir örnek, SQL Server. Windows Grup üyeliği sorgulanamıyor tarafından bir SQL Server oturum açma veya bir SQL Server Uygulama bir roldür.
Örnekler
Aşağıdaki örnek, geçerli kullanıcı için bir Windows etki alanı grubu ya da bir veritabanı rolü bir üyesi olup olmadığını denetler.
-- Test membership in db_owner and print appropriate message.
IF IS_MEMBER ('db_owner') = 1
PRINT 'Current user is a member of the db_owner role'
ELSE IF IS_MEMBER ('db_owner') = 0
PRINT 'Current user is NOT a member of the db_owner role'
ELSE IF IS_MEMBER ('db_owner') IS NULL
PRINT 'ERROR: Invalid group / role specified'
GO
-- Execute SELECT if user is a member of ADVWORKS\Shipping.
IF IS_MEMBER ('ADVWORKS\Shipping') = 1
SELECT 'User ' + USER + ' is a member of ADVWORKS\Shipping.'
GO