FireDAC – MSSQL – Stored Proc context details?

FireDAC – MSSQL – Stored Proc context details?

Without adding parameters to the stored procedure, is it possible to pass / push more process context info than what MSSQL already has in sp_who?

In particular: client app processid and thread id

Any optional connection parameter or similar?

#firedac   #mssql  

2 thoughts on “FireDAC – MSSQL – Stored Proc context details?

  1. 1. select HOST_ID()   returns the PID of the client on the machine that is executing the SQL or T-SQL code.  

    2. FDConnection.Params.Values[‘ApplicationName’] := AppId + ‘ pid=’ + IntToStr(GetCurrentProcessId)+’;tid=’ + IntToStr(GetCurrentThreadId);

    sort of works, but requires that you init the connection per thread.  The name is visible in SELECT program_name FROM sys.dm_exec_sessions  among other places.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.