In sql server 2008, the system views sys.database_role_members and sys.database_principals, only returns the users and group that the current account is allowed to view.
I need to check id a certain account exists, so I need to see all the existing sql account accounts, regardless the permissions of the current account, I mean, just like it used to be in previous versions.
Is there some option like 'EXECUTE AS OWNER' but for views?
Something like
create view dbo.vUsers select as owner as
select * from sys.database_principals

WHEREclause could be tied toORIGINAL_LOGINeven if the procedure is marked asEXECUTE AS OWNER... – Aaron Bertrand♦ Feb 14 '12 at 22:06