CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  MS-SQL Server >  疑难问题

查询内并行度导致服务器命令(进程 ID #74)死锁。请重新运行该查询,并在查询中用查询暗示选项 (maxdop 1) 去掉查询内并行度。

楼主gaojier1000(V2※高捷)2006-03-04 14:48:43 在 MS-SQL Server / 疑难问题 提问

如题,不知道怎么解决,源代码这样的:  
  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

相关问题

  • 死锁
  • 死锁问题
  • 死锁问题
  • 死锁问题
  • 死锁问题
  • 线程死锁
  • 求救,死锁.
  • 死锁问题!!!
  • Runtime.exec() 死锁?
  • ORACLE死锁问题!!

关键词

  • 查询
  • 语句
  • 分析器
  • tyrsp
  • macid
  • ssinf
  • rtrim
  • tyrno
  • textu
  • brdde

得分解答快速导航

  • 帖主:gaojier1000
  • wgsasd311

相关链接

  • SQL Server类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo