This code create a table to log all connections. It is very simple, it just logs when, who, from where and which database. For this we use “master.dbo.sysprocesses” https://docs.microsoft.com/en-us/sql/relational-databases/system-compatibility-views/sys-sysprocesses-transact-sql?view=sql-server-2017 Create table to log...

1 2go 3-- Last SQL Server instance restart. 4SELECT sqlserver_start_time FROM sys.dm_os_sys_info; 5go 6-- Last SQL Agent Server restart. 7SELECT login_time as 'sqlserver_agent_start_time' FROM master.dbo.sysprocesses WHERE program_name = N'SQLAgent - Generic Refresher'; 8go 9-- Last DB windows server restart. 10exec...