T-SQL HOST_ID and HOST_NAME

HOST_ID and HOST_NAME

Included in T-SQL for SQL Server is a functions that returns the workstation information that executes a SQL statement.  You can use this to record what workstation the transaction came from in your application or business intelligence processes.

HOST_ID will return the Process ID from the client  machine that is running the transaction.  By combining this with HOST_NAME which returns the client machines name.  You can create a log in your database for insert and updates.  If you have never looked into these functions it is worth a look to see how they may help you track and audit your applications and ETL processes.

 

HOST_ID – https://msdn.microsoft.com/en-us/library/ms177605.aspx

HOST_NAME – https://msdn.microsoft.com/en-us/library/ms178598.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *