In case of Temporary Tables,we see that they are connection dependent,I mean Tables created in one connection is only available to that connection and automatically dropped when the connection is lost or destroyed.
What are the difference between connection and session in SQL Server?
Literally :
Connection is Physical Communication Channel and Session is a state of information exchange. A Connection may have multiple sessions
.The connection is the physical communication channel between SQL Server and the application: the TCP socket, the named pipe, the shared memory region. The session in SQL Server corresponds to the Wikipedia definition of a session: a semi-permanent container of state for an information exchange. In other words the sessions stores settings like cache of your login information, current transaction isolation level, session level
SET
values etc etc.Normally there is one session on each connection, but there could be multiple session on a single connection (Multiple Active Result Sets, MARS) and there are sessions that have no connection (SSB activated procedures, system sessions). There are also connections w/o sessions, namely connections used for non-TDS purposes, like database mirroring
sys.dm_db_mirroring_connections
or Service Broker connectionssys.dm_broker_connections
.I got the reference from here
common concepts that get used with SQL Server thread management and scheduling :