Could not obtain information about Windows NT group user

后端 未结 9 970
一生所求
一生所求 2020-12-30 19:24

I am creating a SQL Server Replication using a script. When I try to execute

The job failed. Unable to determine if the owner (STAR\\moorer7) of job L3BPT2M-

9条回答
  •  长情又很酷
    2020-12-30 19:37

    In my case I was getting this error trying to use the IS_ROLEMEMBER() function on SQL Server 2008 R2. This function isn't valid prior to SQL Server 2012.

    Instead of this function I ended up using

    select 1 
    from sys.database_principals u 
    inner join sys.database_role_members ur 
        on u.principal_id = ur.member_principal_id 
    inner join sys.database_principals r 
        on ur.role_principal_id = r.principal_id 
    where r.name = @role_name 
    and u.name = @username
    

    Significantly more verbose, but it gets the job done.

提交回复
热议问题