--查看当前用户 应用 及IP
SELECT ORIGINAL_LOGIN(),APP_NAME(), CONNECTIONPROPERTY('CLIENT_NET_ADDRESS') , CONNECTIONPROPERTY('PROTOCOL_TYPE')
--查看连接用户
SELECT
SP.SPID,
SP.LOGINAME,
SP.LOGIN_TIME,
SP.HOSTNAME,
SP.PROGRAM_NAME,
DC.CLIENT_TCP_PORT,
DC.CLIENT_NET_ADDRESS
FROM SYS.SYSPROCESSES AS SP
INNER JOIN SYS.DM_EXEC_CONNECTIONS AS DC
ON SP.SPID = DC.SESSION_ID
WHERE SP.SPID > 50
AND DC.AUTH_SCHEME='SQL'
--查看连接用户详细信息
SELECT * FROM SYS.DM_EXEC_SESSIONS WHERE SESSION_ID= 54
SQLSERVER 查看当前用户 应用 及IP
最新推荐文章于 2023-09-01 07:45:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)