Use Application Name parameter when connecting to SQL Server
by Ibrahim de Untruepe
This optional parameter can be a life saver. The DBAs will love that you provide this info for the connection.
If several apps are using a shared SQL Server and there are problems caused by a certain connection, the database administrators will be able to locate that connection by something called a SPID. However determining what application or website is responsible for the connection causing the error is harder. But if the developer includes the "Application Name" property in the connection string then it will be very easy for the database administrator to see the name of the application that is causing the trouble. This will save hours for the DBA and it will make the developer popular amongst the DBAs.
Simply include "Application Name=MyAppName;" in the connection string. After that it is also possible to use that value in SQL batches or SPROCs with the command, "SELECT APP_NAME();".
Always Include the optional Application Name parameter in your connection strings when connecting to SQL Server. This way the SQL Server will have info on what application is using the connection. This can be invaluable info when locating errors in the database server.