Monitor SQL Connection from .NET SQLCLIENT DATA Provider

zhaozj2021-02-16  72

You can Use the Following SQL Script to Monitor SQL Server Processes and Connections, Whose Function IS Almost The Same AS SP_WHO & SP_WHO2.

SELECT

SPID, UID

=

RTRIM

(loginame), program_name

=

RTRIM

(Program_name), DBNAME

=

DB_NAME

(DBID), Status

=

RTRIM

(status)

From

Master.dbo.sysprocesses

WHERE

Loginame

=

'

sa or other login name

'

and

DB_NAME

(DBID)

=

'

Database Name

'

AND

Program_name

=

'

.NET SQLCLIENT DATA Provider

'

EG.

SELECT

SPID, UID

=

RTRIM

(loginame), program_name

=

RTRIM

(Program_name), DBNAME

=

DB_NAME

(DBID), Status

=

RTRIM

(Status)

From

Master.dbo.sysprocesses

WHERE

Loginame

=

'

SA

'

and

DB_NAME

(DBID)

=

'

Hris2004

'

AND

Program_name

=

'

.NET SQLCLIENT DATA Provider

'

转载请注明原文地址:https://www.9cbs.com/read-16390.html

New Post(0)