Query #1 is Version Info. SQL and OS Version information for current instance SELECT @@SERVERNAME AS [Server Name], @@VERSIONAS [SQL Server and OS Version Info]; Query #2 is Core Counts. Get socket, physical core and logical core count from the SQL S…
Query #13 SQL Server Error Log(FC) -- Shows you where the SQL Server failover cluster diagnostic log is located and how it is configured SELECT is_enabled, [path], max_size, max_files FROM sys.dm_os_server_diagnostics_log_configurations WITH (NOLOCK)…
Query #57 Buffer Usage -- Breaks down buffers used by current database by object (table, index) in the buffer cache -- Note: This query could take some time on a busy instance SELECT OBJECT_NAME(p.[object_id]) AS [Object Name], p.index_id, CAST(COUNT…
Query #41 Memory Clerk Usage -- Memory Clerk Usage for instance -- Look for high value for CACHESTORE_SQLCP (Ad-hoc query plans) SELECT TOP(10) mc.[type] AS [Memory Clerk Type], CAST((SUM(mc.pages_kb)/1024.0) AS DECIMAL (15,2)) AS [Memory Usage (MB)]…
Expert for SQL Server 诊断系列 Expert 诊断优化系列------------------锁是个大角色 前面几篇已经陆续从服务器的几个大块讲述了SQL SERVER数据库的诊断和调优方式.加上本篇可以说已经可以完成常规的问题诊断及优化,本篇就是SQL SERVER中的锁.为了方便阅读给出系列文章的导读链接: SQL SERVER全面优化-------Expert for SQL Server 诊断系列 首先阅读本文之前,大家都应该知道锁是影响你性能的一个重大因素,那…
where in 的参数化查询实现 首先说一下我们常用的办法,直接拼SQL实现,一般情况下都能满足需要 string userIds = "1,2,3,4"; using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand comm = new SqlCommand(); comm.Connection = conn; comm.CommandText = string…
转载至:http://www.cnblogs.com/lzrabbit/archive/2012/04/22/2465313.html 文章导读 拼SQL实现where in查询 使用CHARINDEX或like实现where in 参数化 使用exec动态执行SQl实现where in 参数化 为每一个参数生成一个参数实现where in 参数化 使用临时表实现where in 参数化 like参数化查询 xml和DataTable传参 身为一名小小的程序猿,在日常开发中不可以避免的要和wh…