Search notes:

SQL Server session

The id of the current session is stored in @@spid.

Obtaining some session info

select
  @@spid            as ses_id,
  session_user      as ses_usr,
  current_user      as cur_usr,
  system_user       as sys_usr,
  user_name()       as nam_usr,
  user              as usr
;
Github repository about-MSSQL, path: /architecture/session/spid-user-etc.sql

Killing a session

A session (or more accurately a process) can be killed with the kill statement.
c:\> sqlcmd -A
select blocked from sys.dm_exec_requests where blocked <> 0;
go
.... some numbers returned ...
kill 42
go

Session language

The session language determines
The session language is set with set language …

See also

architecture
Settings that pertain to a session can be altered with the set statement.
sp_who and sp_who2.
db-off-on.sql is a script that offlines and onlines a database, thus making sure that no session is running on the database afterwards.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740459592, '3.145.115.25', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/architecture/session/index(84): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78