sqlserver 数据库死锁后多长时间解锁?
各位大侠,sqlserver 数据库死锁后,会不会自动解锁呢?多长时间能自动解锁呢?谢谢!
SQL code:
use master
go
create procedure sp_who_lock
as
begin
declare @spid int,@bl int,
@intTransactionCountOnEntry int,
@intRowcount int,
@intCountProperties int,
@intCounter int
create table #tmp_lock_who (
id int identity(1,1),
spid smallint,
bl smallint)
IF @@ERROR<>0 RETURN @@ERROR
insert into #tmp_lock_who(spid,bl) select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a
where not exists(select * from
(select * from sysprocesses where blocked>0 ) b
where a.blocked=spid)
union select spid,blocked from sysprocesses where blocked>0
IF @@ERROR<>0 RETURN @@ERROR
-- 找到临时表的记录数
select @intCountProperties = Count(*),@intCounter = 1
from #tmp_lock_who
IF @@ERROR<>0 RETURN @@ERROR
if @intCountProperties=0
select '现在没有阻塞和死锁信息' as message
-- 循环开始
while @intCounter <= @intCountProperties
begin
-- 取第一条记录
select @spid = spid,@bl = bl
from #tmp_lock_who where Id = @intCounter
begin
if @spid =0
select '引起数据库死锁的是: '+ CAST(@bl AS VARCHAR(10))
+ '进程号,其执行的SQL语法如下'
else
select '进程号SPID:'+ CAST(@spid AS VARCHAR(10))+ '被'
+ '进程号SPID:'+ CAST(@bl AS VARCHAR(10)) +'阻塞,其当
前进程执行的SQL语法如下'DBCC INPUTBUFFER
自己试下
{{--
相关问答:
我的数据库是简体sqlserver2000 ,我想在繁体access下连接,通过odbc是可以了,但在access下出现打开的表全中"#已删除"
不知道要怎么操作才可以用ACCESS繁体连接简体sqlserver2000.谢谢!!!
大家都 ......
数据10W条以上,wm6.5平台,内存有限
C# code:
private void connserver()
{
Cursor.Current = Cursors.WaitCursor;
try
{
......
比如 用户名,我程序的要求是10位字符以内,所以:
如果我sqlserver从varchar(50)存储改为用varchar(10)的话,
1.会不会减少数据空间?
2.会不会提高我程序的效率?
3.有没有必要?
小弟先谢 ......
请问一下,外网两台SQLSERVER实例数据传输,有没有采用数据压缩和加密。压缩比是多少,加密是什么加密算法?相关文档哪里可以找到?谢谢
我也想知道!关注此贴!
关注~~
数据库大牛都哪去了啊?
......
比如 传进来的字符串是 ‘12/sep/2009 12:52:20’ 直接用cast会报错。
而且中间的月份也不固定 。怎么转换成日期型的呢
用一个表记录1-12月份!
直接转换是不行了 拆分 出月来判断了
‘12/sep/2009 12: ......