简体   繁体   中英

How to get Hostname in T-SQL?

我需要将我的客户端名称保存在SQL Server上的相关数据库中,我不想通过参数接收它,即使我想从存储过程中插入。

我的问题通过在存储过程中使用下面的代码来解决。

SELECT HOST_NAME()

Another good approach would be using sp_who2 system procedure like below. Checkout for the login , hostname , dbname and command column.

exec sp_who2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM