April 12, 2011 at 5:40 am
Any reason to use one of the following over the other to return the user currently modifying data?
SELECT SUSER_NAME()
SELECT SUSER_SNAME()
The documentation for SUSER_NAME() says "SUSER_NAME returns a login name only for a login that has an entry in the syslogins system table.".
SUSER_SNAME() documentation makes no reference to this does this imply that SUSER_NAME is more limited in some way than SUSER_SNAME?
April 12, 2011 at 6:52 am
I think you are supposed to use SUSER_SNAME() in most situations.
i believe the difference is SUSER_SNAME() would return a domain\username for those people who are not explicitly on the server, but only get access through an inherited role;
so if you grant a windows role access, SUSER_SNAME() would return results, but SUSER_NAME() is blank, because that user is not explicitly in the sys.server_principals table, right?
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply