查询内并行度导致服务器命令(进程 ID #74)死锁。请重新运行该查询,并在查询中用查询暗示选项 (maxdop 1) 去掉查询内并行度。
如题,不知道怎么解决,源代码这样的:
select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,right(rtrim(ssinf.TYRSP),2)as BRAND,
left(rtrim(ssinf.TYRSP),4)AS SPECI,
substring(ssinf.TYRSP,5,2)AS LAYER,
substring(ssinf.TYRSP,7,3)AS TEXTU,
(select BRDDE from CTTBC where BRAND=right(rtrim(ssinf.TYRSP),2))as BRDDE,
(select SPEDE from CTTSC where SPECI=left(rtrim(ssinf.TYRSP),4)) as SPEDE,
(select LAYDE from CTTLC where LAYER=substring(ssinf.TYRSP,5,2)) as LAYDE,
(select TEXDE from CTTTC where TEXTU=substring(ssinf.TYRSP,7,3)) as TEXDE,
(select macna from smnin where macid=ssinf.macid)AS MACHI
from ssinf where right(rtrim(ssinf.TYRSP),2)='01' and macid='14001' order by tyrno
问题点数:50、回复次数:13Top
1 楼wgsasd311(自强不息)回复于 2006-03-04 15:03:33 得分 50
上述语句单独在查询分析器执行会报错吗?Top
2 楼gaojier1000(V2※高捷)回复于 2006-03-04 15:32:47 得分 0
是的,报上述错误。Top
3 楼wgsasd311(自强不息)回复于 2006-03-06 09:16:05 得分 0
--try
select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(ssinf.TYRSP),2)as BRAND,
left(rtrim(ssinf.TYRSP),4)AS SPECI,
substring(ssinf.TYRSP,5,2)AS LAYER,
substring(ssinf.TYRSP,7,3)AS TEXTU,
(select BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select macna from smnin where macid=a.macid)AS MACHI
from ssinf a
where right(rtrim(ssinf.TYRSP),2)='01'
and macid='14001'
order by tyrno
Top
4 楼wgsasd311(自强不息)回复于 2006-03-06 09:27:01 得分 0
--我上面写错了,try
--try
select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select top 1 macna from smnin where macid='14001')AS MACHI
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrno
Top
5 楼gaojier1000(V2※高捷)回复于 2006-03-06 09:33:18 得分 0
谢谢,但是是什么原因造成的,能否详细的说明一下啊!Top
6 楼gaojier1000(V2※高捷)回复于 2006-03-06 10:05:50 得分 0
还是不行,你把(select top 1 macna from smnin where macid='14001')AS MACHI
直接赋值了,我要求是动态的,修改后问题依旧,
原存储过程:
Create PROCEDURE sp_getSulfTyreInfo
@sql varchar(1000)
AS
declare @tempSql varchar(3000)
select @tempSql ='select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select top 1 macna from smnin where macid=a.macid)AS MACHI
from ssinf a
where '+@sql+' order by tyrno'
print @tempSql
Exec(@tempSql)
我动态赋条件为:right(rtrim(a.TYRSP),2) and macid='14001',然后执行存储过程就会出现上述错误。自强兄修改后,问题依旧!
Top
7 楼gaojier1000(V2※高捷)回复于 2006-03-06 10:07:55 得分 0
抱歉,条件是right(rtrim(a.TYRSP),2)='01' and macid='14001'Top
8 楼wgsasd311(自强不息)回复于 2006-03-06 10:47:12 得分 0
把语句打出来,放到查询分析器执行试下.
我上面写给你的语句你在查询分析器执行没错,那么你修改后在存储过程出错说明你的存储过程执行的语句并不是我给你的语句.Top
9 楼gaojier1000(V2※高捷)回复于 2006-03-06 10:51:04 得分 0
我执行你的语句没有问题,但是你是把(select top 1 macna from smnin where macid='14001')AS MACHI
这句给直接加上条件了,我的是根据动态的sql条件来执行的。所以你的没有错误,我的有错误。
你把你的语句改成:
select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select top 1 macna from smnin where macid=a.macid)AS MACHI
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrno试试,是不通过的!Top
10 楼wgsasd311(自强不息)回复于 2006-03-06 11:13:30 得分 0
上面语句你改的对,在查询分析器里执行会报错吗?Top
11 楼gaojier1000(V2※高捷)回复于 2006-03-06 11:16:52 得分 0
报错,现在问题解决了,但是我不明白这两句话的区别:
1、select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select top 1 macna from smnin where macid=a.macid)AS MACHI
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrno
2、select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 macna from smnin where macid=a.macid)AS MACHI,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrnoTop
12 楼gaojier1000(V2※高捷)回复于 2006-03-06 11:17:54 得分 0
我只是挪动了一下(select top 1 macna from smnin where macid=a.macid)AS MACHI,的位置,第一句就报错,第二句就没有错误!Top
13 楼gaojier1000(V2※高捷)回复于 2006-03-09 09:04:19 得分 0
赶紧帮忙啊,比较两个语句的区别:
1、select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE,
(select top 1 macna from smnin where macid=a.macid)AS MACHI
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrno
2、select tyrno,tyrsp,stada,endda,mouno,infid,macid,MSHFT,
right(rtrim(a.TYRSP),2) as BRAND,
left(rtrim(TYRSP),4)AS SPECI,
substring(TYRSP,5,2)AS LAYER,
substring(TYRSP,7,3)AS TEXTU,
(select top 1 macna from smnin where macid=a.macid)AS MACHI,
(select top 1 BRDDE from CTTBC where BRAND=right(rtrim(a.TYRSP),2))as BRDDE,
(select top 1 SPEDE from CTTSC where SPECI=left(rtrim(a.TYRSP),4)) as SPEDE,
(select top 1 LAYDE from CTTLC where LAYER=substring(a.TYRSP,5,2)) as LAYDE,
(select top 1 TEXDE from CTTTC where TEXTU=substring(a.TYRSP,7,3)) as TEXDE
from ssinf a
where right(rtrim(a.TYRSP),2)='01'
and a.macid='14001'
order by tyrno
第一个语句报如题的错误,第二个没有报错!Top




