Detection and Control of Connected Users in SQL Server
Hello to everyone,
In this article, I will provide information about the detection and control of connected users in SQL Server.
In SQL Server, in some cases, you may want to detect users connected to SQL Server.
You can easily do this using the code below.
SELECT program_name,
SUBSTRING(CONVERT(NVARCHAR, MAX(login_time)), LEN(CONVERT(NVARCHAR, MAX(login_time))) - 6, 8)
FROM master.dbo.sysprocesses
GROUP BY program_name;
When you run the above code, you will get a result similar to the one below.
As you can see, we have detected users connected to SQL Server.
I also connected to SQL Server with HeidiSQL as an example. It appears in the photo.
Good luck to everyone in business and life.