gpt4 book ai didi

sql-server - 如何获取Azure SQL Server的连接数?

转载 作者:行者123 更新时间:2023-12-02 07:32:33 26 4
gpt4 key购买 nike

在 Azure Sql Server 上删除数据库之前,我必须检查是否有其他用户连接到该数据库。

使用存储过程 sp_who2 失败并显示:“找不到存储过程'sp_who2'。”

尝试从 sys.sysprocesses 获取信息也失败,并显示消息:

"Reference to database and/or server name in 'master.dbo.sysprocesses' is not supported in this version of SQL Server."

如何获取我需要的信息?

最佳答案

快速谷歌搜索发现 this approach在 SQL Azure 中工作得很好。然而,它仅在具体数据库的上下文中有效!请记住,在 SQL Azure 中,您一次只能使用单个数据库。如果您需要来自多个数据库的数据,您必须分别为每个数据库执行该语句。

旁注,我无法让 sp_who 在 SQL Azure 中工作。

编辑

以下为证据截图: enter image description here

关于sql-server - 如何获取Azure SQL Server的连接数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8180934/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com