Tuesday, December 2, 2014

Difference between APP_NAME() and PROGRAM_NAME()

Hi,


We are passing Application Name dynamically from the connection string (.net) and using it in SQL 2008 trigger using PROGRAM_NAME() from sys.dm_exec_sessions. Most of the time we get the desired result but sometimes it returns ".Net SqlClient Data Provider".


Please suggest is there any issue in using sys.dm_exec_sessions. We are using following query to get application name in trigger.


"select top 1 program_name from sys.dm_exec_sessions"


Should we use APP_NAME instead?


Please help.



No comments:

Post a Comment