Get Host ID and Name – SQL Function
HOST_ID() function returns a ten character workstation identification number. This number is an application process ID running in the client computer.
HOST_NAME() function returns the client computer name. The return value of this function is nvarchar(128).
Output: <Process ID>
In my computer, it shows 3216 and to double-check this number I open the task manager and look at my SSMS process ID as shown below.
Output: <Client Computer name>
You can execute these queries in your management studio and see the output. We can use Host ID and Name in your application as an identification value. such as, storing client machine name as a column value to check who has inserted a row into the table.
But, please note that the HOST_NAME can provide inaccurate data. So, avoid using this as a security feature in your application.