Like ever, today’s article of Pinal Dave was interesting and informative. After, our mutual discussion between our DBAs and Developers on Pinal Dave topic of Concurrency and Isolation. I felt that most of us are intermingling three equally sounding w…
select str(request_session_id ,4 ,0) as SPID ,convert(varchar(20) ,db_name(resource_database_id)) as db_name ,resource_associated_entity_id ,O.name ,resource_type ,request_type ,request_mode ,request_status from sys.dm_tran_locks as A with (nolock) l…
https://stackoverflow.com/questions/2404565/sql-server-difference-between-partition-by-and-group-by They're used in different places. group by modifies the entire query, like: select customerId, count(*) as orderCount from Orders group by customerId…
Locking is a major part of every RDBMS and is important to know about. It is a database functionality which without a multi-user environment could not work. The main problem of locking is that in an essence it's a logical and not physical problem. Th…
今天我想讲解一个特别的问题,在我每次讲解SQL Server里的锁和阻塞(Locking & Blocking)都会碰到的问题:在SQL Server里,为什么我们需要更新锁?在我们讲解具体需要的原因前,首先我想给你介绍下当更新锁(Update(U)Lock)获得时,根据它的兼容性锁本身是如何应对的. 一般来说,当执行UPDATE语句时,SQL Server会用到更新锁(Update Lock).如果你查看对应的执行计划,你会看到它包含3个部分 读取数据 计算新值 写入数据 在查询计划的第1部分…
SQL SERVER 2008配置Database Mail –用SQL  数据库发邮件 https://blogs.msdn.microsoft.com/apgcdsd/2011/06/28/sql-server-2008database-mail-sql/ 原文来自:http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/  Aug…
1 . 模拟Dead Lock Session1: begintran insertintoT1(name)values('test1') UpdateT2setname='test1' commit Session2: begintran insertintoT2(name)values('test2') UpdateT1setname='test2' commit 交叉每个session执行一句,当session2执行update T1语句时候,会提示deadlocked错误,并且选择这个s…
原文:如何有效抓取SQL Server的BLOCKING信息 转自:微软亚太区数据库技术支持组 官方博客 http://blogs.msdn.com/b/apgcdsd/archive/2011/12/12/sql-server-blocking.aspx SQL Server允许并发操作,BLOCKING是指在某一操作没有完成之前,其他操作必须等待,以便于保证数据的完整性.BLOCKING的解决方法要查看BLOCKING的头是什么,为什么BLOCKING头上的语句执行的很慢.通常来讲只要我们能…
Following is test in SQL Server: USE [TestDB] CREATE TABLE [dbo].[UserInfoTest02]( [number] [bigint] NOT NULL, ) NOT NULL, [age] [int] NOT NULL, [sex] [bit] NOT NULL, ) NULL ) CREATE TABLE [dbo].[UserInfoTest03]( [number] [bigint] NOT NULL, ) NOT NUL…
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful with trace flags, test in your test environment first. And consult professionals first if you are the slightest uncertain about the effects of your cha…