EXECUTE AS returning wrong user
-
05-06-2023 - |
Question
I'm running into a weird situation. This code is running fine on all but one server.
set nocount on
SELECT SUSER_NAME(), USER_NAME();
execute as user = 'guest';
SELECT SUSER_NAME(), USER_NAME();
revert;
SELECT SUSER_NAME(), USER_NAME();
This returns my username for the first and third statements on all servers. On the problem servers it returns a fellow dev's logon information instead of guest. Something like DOMAIN\joeblow.
Is there a SQL Server setting I should be setting or some other issue I don't know of? We're running SQL Server 2008 R2.
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow