January 3, 2003 at 9:52 am
I am looking for a way to identify a specific connection to a SQL Server database, preferrably through a query on a system table. I don't have an environment to work in yet and am new to SQL Server, so I'm going strictly off documentation to write specs. I have seen the sysprocesses table in the doc, and am thinking that the spid stored there may be what I need. I was wondering if anyone else out there had an opinion on the right id to use.
The premise behind what I want to use the id for is to be able to log it to a table, and then have other sessions query that table later to see if the id logged previously is still active or not. We're using it to manage concurrency for multiple sessions that could be performing similar tasks. So, if the spid is something that would often be reused (e.g. when session identified by spid=55 disconnects, spid=55 will be immediately reused for a new connection) then spid is not what I want. Reuse of the numbers might be OK as long as it would take a while for that id to be reassigned to a different session.
Also note that the way we have been doing things on other RDBMS platforms is that most users connect to the database itself with the same database username - so a userid isn't going to work for me either.
I've tried to stay at a high level for purposes of this post... hopefully I've provided enough info.
Thanks,
Robin
January 3, 2003 at 9:57 am
the SPID is what you need, but you may need to store this along with some other identifier of the individual.
We used to do something similar in that we would store the SPID in a table along with a username from a table, not a SQL Server username. Then the admin would be able to tell if a user was logged in and what they were doing. Another way is to make each user use some identifier and then store that in a table each time the user does something.
Steve Jones
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply