update TableA
set custname=srv_lnk.TableB.dbo.custtable.custname
from TableA,[srv_lnk.TableB.dbo.custtable]
where ltrim(rtrim(TableA.id))=ltrim(rtrim([srv_lnk.TableB.dbo.cysttable].id))出错为:
erver: Msg 117, Level 15, State 2, Line 3
The number name 'srv_lnk.TableB.dbo.custtable' contains more than the maximum number of prefixes. The maximum is 3.请问要如何改才可以呢? 请高手帮忙,谢谢.

解决方案 »

  1.   

    update TableA
    set custname=a.custname
    from TableA,[srv_lnk.TableB.dbo.custtable] a
    where ltrim(rtrim(TableA.id))=ltrim(rtrim(a.id))
      

  2.   

    --tryupdate TableA
    set custname=t.custname
    from TableA,[srv_lnk.TableB.dbo.custtable] t
    where ltrim(rtrim(TableA.id))=ltrim(rtrim(t.id))
      

  3.   

    试过了,还是出错如下:
    erver: Msg 446, Level 16, State 9, Line 1
    Cannot resolve collation conflict for equal to operation.
      

  4.   

    Do you confirm the collate of the field custname in both table are the same one?Try view this linkhttp://msdn2.microsoft.com/zh-cn/library/ms179886.aspx
      

  5.   

    两笔的字段名称不同,字节数也不同,但是他们的内容相同. 我加了ltrim(rtrim())来约束不可以吗?
      

  6.   

    是不是srv_lnk.TableB.dbo.custtable
    表的数据不唯一
      

  7.   

    两笔的字段名称不同,字节数也不同,但是他们的内容相同. 我加了ltrim(rtrim())来约束不可以吗?如果两个id都是字符型就不会有问题,在不成就是其中一个表中的id列中有重复的值,会导致更新不成功。
      

  8.   

    两笔的字段名称不同,字节数也不同,但是他们的内容相同. 我加了ltrim(rtrim())来约束不可以吗?
    ==========================================
    Cannot resolve collation conflict for equal to operation.
    这个错误的意思是说,这两个列的排序规则不同,那就无法比较了。
    就比如说一个规则是区分大小写,另外一个是不区分大小写,那么你说A和a到底是等还是不等呢?
    这个时候就需要你指定排序规则了!在最后面加上“Collate [适合你的排序规则]”一般中文版的SQLServer的Varchar,Char字段的用Chinese_PRC_CI_AS(大小写不敏感的)或Chinese_PRC_CS_AS(大小写敏感的)排序规则就可以了。一个是CI(Case Insensitive),另外一个是CS(Case Sensitive)!至于“排序规则”是什么,你可以查一下SQLServer的联机帮助。
      

  9.   

    在最后面加上“Collate [适合你的排序规则]”
    ===========================================
    这个应该是在ltrim(rtrim(TableA.id))=ltrim(rtrim(t.id))之后,并不是每个查询都是放在最后的,并不是放在Where条件之后。