SELECT SERVERPROPERTY('ServerName') AS ServerName SELECT SERVERPROPERTY('BuildClrVersion') AS BuildClrVersion SELECT SERVERPROPERTY('Collation') AS Collation SELECT SERVERPROPERTY('CollationID') AS CollationID SELECT SERVERPROPERTY('ComparisonStyle')…
今天进行负载均衡的测试的时候 想查询一下数据库相关信息 百度了下 找到解决方案为: SELECT SERVERNAME = CONVERT(NVARCHAR(),SERVERPROPERTY('SERVERNAME')) ,LOCAL_NET_ADDRESS AS 'IPAddressOfSQLServer' ,CLIENT_NET_ADDRESS AS 'ClientIPAddress' FROM SYS.DM_EXEC_CONNECTIONS WHERE SESSION_ID = @@SPI…
经常会需要分析SQLSERVER的阻塞情况,尤其是某些SQL操作异常缓慢从而怀疑是有人在搞事情的情况下.网上有许多一模一样的帖子,是关于sp_who_lock这个存储过程的,然而,网上流传的这个是略有问题的(被阻塞的SQL输出有误),为此改造了一下实现,顺便优化了一下输出结构: CREATE PROCEDURE [dbo].[sp_who_lock] AS BEGIN DECLARE @spid INT , @bl INT , @intTransactionCountOnEntry INT ,…