From a stored procedure in SQL Server, is it possible to get the name of the executable (ie MyApp.exe) that owns the connection? I know there is APP_NAME(), but that appears to just return whatever string was passed into the ‘Application Name’ parameter in the connection string.
If this is possible, how can it be done? Thanks.
Unfortunately I’m not aware of any such thing — remember that the connection is coming from an entirely different machine most likely.
Perhaps you can design you security so that different apps are using different user names to access the database. Finding the current user is easy.