sysprocesses.hostprocess unique?

  • It is not unique.

    It's not the session id from sysprocesses. It's the process ID (windows process ID) that the client application has on the client machine.

    Go to a client, open Task Manager and look at the PID column. That's the Host Process ID.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Gail, I have suspected that since I checked the Task Manager in Windows. So, this data is set by Windows itself, instead of SQL and it is possible to be repeated for a few machines in a network.

    In our application this function was designed 10 years ago, to work with SQL 7. I wonder why the consultant created the PK of our table based in the hostprocess of the sysprocesses instead of the spid.

    I understand that the spid column may be repeated, in case of parallelism, but only for the same connection. SQL will never give a repeated spid number for two different connections at same time, correct?

    Thanks again for your prompt reply.

  • marcolorado (10/29/2015)


    SQL will never give a repeated spid number for two different connections at same time, correct?

    Correct, just be careful, the SPID can be reused very quickly after a session disconnects.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply