Reputation: 355
I have 2 application (websites) on one IIS and which is calling same remote database. Is there any thing in SQL server which will give me in stored procedure that who is calling :) ?
Upvotes: 2
Views: 2740
Reputation: 28900
You need to modify your connection strings and add Application Name
Data Source=myServer;
Initial Catalog=myDB;
User Id=myUsername;
Password=myPassword;
Application Name=myApp;
Now when you query sys.processes,program name will be application name
References:
http://johnnycoder.com/blog/2006/10/24/take-advantage-of-application-name/
https://www.connectionstrings.com/sql-server/
Check this thread if you are using VB.NET:
How to set "Application Name" in ADODB connection string
if not above will work
Upvotes: 1
Reputation: 212
APP_NAME() returns the application name for the current session if set by the application. An another way of identifying the app is to log the app name through the CRUD operation , so that an additional field will be added in the tables to hold the app name.
Upvotes: 1