We have two SQL 2014 servers, and I have created a Linked Server on one of them to the other. As part of a task I'm trying to run I need to convert a SQL UserID to a username on both the local and the linked server.
On the local server I can just call
which will return the string
Is there an easy way to run the function
SUSER_NAME on the linked server to get a value back from there?
The other alternative I think I've found is to do a join to
sys.server_principals and pull out the name from there, but
SUSER_NAME seems like a cleaner approach.