Sybase sp_who truncates hostname

倖福魔咒の 提交于 2019-12-04 13:32:28

sp_who pulls and joins information from several tables to give it's report. It's not intended to produce output that can be used for input on something else. If you need information from sp_who, it's better to just run your own query against sysprocesses. Unfortunately, in this case, doing your own query won't help, as the hostname is not changed by sp_who. In Sybase the hostname is set by the application that is connecting, not the server (try select hostname from master..sysprocesses and you'll see).

One solution would be to add a set clientname or set clienthostname command as part of your connection string from these other clients. I believe this can be done via ODBC. Othewise you can use the sysprocesses.ipaddr column to differentiate between hosts:

select fid, spid, status, suser_name(suid), clienthostname, ipaddr
from master..sysprocesses
where suid = suser_id('username')
order by ipaddr, spid
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!