摘要: 出现名为'MM_CURSOR' 的游标已存在。一般出现这样的问题是:1:游标没有 --关闭 释放如:Sql代码--关闭游标CLOSEMM_CURSOR--释放游标DEALLOCATEMM_CURSOR2:游标已存在同名情况,此时就需要在定义游标时申明一个局部的游标如:Sql代码/*检索已经配置好的新村镇的所有乡级部门*/---申明游标DECLAREdeptCursorCURSORlocalFORSELECTdeptname,deptsimplename,distid,deptuncode,deptqueryno,ifreport,deptsort,enable,deptfloo 阅读全文
posted @ 2012-07-02 17:55 挑战 阅读(9295) 评论(1) 推荐(0) 编辑
摘要: 检测死锁如果发生死锁了,我们怎么去检测具体发生死锁的是哪条SQL语句或存储过程?这时我们可以使用以下存储过程来检测,就可以查出引起死锁的进程和SQL语句。SQL Server自带的系统存储过程sp_who和sp_lock也可以用来查找阻塞和死锁, 但没有这里介绍的方法好用。 use mastergocreate procedure sp_who_lockasbegindeclare @spid int,@bl int,@intTransactionCountOnEntry int, @intRowcount int, @intCountProperties int, @intCounter i 阅读全文
posted @ 2012-07-02 14:27 挑战 阅读(3452) 评论(0) 推荐(0) 编辑