`
Par2: Who's logged on -- SQL 2009-03-12 -- J Shankar >Does anyone know how I can read the MS SQL sp_hook to determine in a station
>is logged on. This is my thinking, I would like to write a function that can
>allow a user to logon only once to the database.
I use a query shown below to find out all users logged into a database ::
SELECT master.dbo.sysprocesses.nt_username AS NetworkUserName,
master.dbo.sysprocesses.loginame AS LoginName,
convert(char(20),master.dbo.sysprocesses.login_time,113) AS LoginTime,
master.dbo.sysdatabases.name AS DatabaseName,
master.dbo.sysprocesses.hostname AS ComputerName,
master.dbo.sysprocesses.net_address AS MACAddress,
master.dbo.sysprocesses.program_name AS ProgramName
FROM master.dbo.sysprocesses, master.dbo.sysdatabases
WHERE master.dbo.sysdatabases.dbid = master.dbo.sysprocesses.dbid
AND master.dbo.sysdatabases.name = '
Printed October 24, 2026, 1:53 pm This article has been viewed/printed 36258 times. |