Sql = "Update EgeWst a set ItemType='OTHER' where sonnum>0 and (select count(*) as rsnum from EgeWst where ParentId=a.ItemId and ItemType='INFO')=0 and ItemType='INFO'"Sql = "select ItemId,Manage_Title,ParentId from (select ItemId,Manage_Title,ParentId from EGeWst a where (SonNum>0 and (select count(id) as rsnum from EgeWst where ParentId=a.ItemId and SonNum=0)>0)) order by ItemId"上面这两句是ACCESS下的语句,现在数据库换成SQL server2000了,报错了,'a' 附近有语法错误。
请教高手,我应该怎么改

解决方案 »

  1.   

    Update EgeWst 
    set ItemType='OTHER' 
    from EgeWst a,(select itemid , count(*) as rsnum from EgeWst where ItemType='INFO' group by itemid) b
    where  a.ParentId=b.ItemId and a.sonnum>0 
      

  2.   

    不好意思,不对啊
    Microsoft VBScript 编译器错误 (0x800A0409)
    未结束的字符串常量
    /buxiugang/webmng/webstruct/Proc_Item_Modify.asp, line 225, column 18
    sql="Update EgeWst
      

  3.   


    Update a set ItemType='OTHER' 
    from EgeWst
    where sonnum>0 and 
    (
    select count(*) as rsnum 
    from EgeWst 
    where ParentId=a.ItemId and ItemType='INFO'
    )=0 
    and ItemType='INFO'
    select ItemId,Manage_Title,ParentId 
    from 
    (
    select ItemId,Manage_Title,ParentId 
    from EGeWst a
    where 
    (SonNum>0 and (select count(id) as rsnum from EgeWst where ParentId=a.ItemId and SonNum=0)>0)
    ) a
    order by ItemId
      

  4.   

    Update a set ItemType='OTHER' 
    from EgeWst as a
    where sonnum>0 and 
    (
    select count(*) as rsnum 
    from EgeWst 
    where ParentId=a.ItemId and ItemType='INFO'
    )=0 
    and ItemType='INFO'
      

  5.   

    select Top " & lnrange & " ID,TITLE,FSIZE,SHOWFLAG,UPDNAME,UPDTIME,XH,dsnum From (select Top " & (lnRange * p_iUsePage) & " a.ID,TITLE,FSIZE,SHOWFLAG,UPDNAME,UPDTIME,XH,(select sum(DNUM) from WEBODOWN where FID=a.Id) as dsnum from WEBDOWN a " & strSearchLimit & " order by xh desc,UPDTIME asc,Id asc) order by xh asc,UPDTIME desc,Id Desc 这里还有一句,我按你的思路修改成这样
    select Top " & lnrange & " ID,TITLE,FSIZE,SHOWFLAG,UPDNAME,UPDTIME,XH,dsnum From (select Top " & (lnRange * p_iUsePage) & " a.ID,TITLE,FSIZE,SHOWFLAG,UPDNAME,UPDTIME,XH,(select sum(DNUM) from WEBODOWN where FID=a.Id) as dsnum from WEBDOWN a " & strSearchLimit & " order by xh desc,UPDTIME asc,Id asc) b order by xh asc,UPDTIME desc,Id Desc
    仍然有错误,该怎么改?
      

  6.   

    strSearchLimit 是什么东西?
      

  7.   

    那是个变量,值是where语句。不是语法的问题,是书库库字段定义的问题,我已经解决了,谢谢你