Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
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 = '
Today is November 21, 2024, 3:28 am This article has been viewed 35235 times.
|
|