问题
I'm writing a SQL trigger on a table that will update an audit table upon any change to specific fields with details of old value, new value, changed by, and timestamp. That is moving along nicely.
I'm wondering if there is a way that I can write a trigger for auditing on a table in a similar fashion but I can also figure out what application executed the query on the database/table? When we write the connection string we have this App property:
...provider connection string="data source=STGPDBCLS;initial catalog=StagingDb;persist security info=True;user id=abc;password=123;MultipleActiveResultSets=True;Connect Timeout=80;App=EntityFramework"...
Does that play a role?
TL;DR
How to get name of application/Source that executed a query on SQL Server
来源:https://stackoverflow.com/questions/59942330/get-application-information-at-sql-server-level-for-auditing