SET @SQL='update '+@tableName+' set '+@fieldName+'='''+@newValue+''' where '+@tableName+'OID='''+@tableOIDValue+''
EXEC sp_executesql @SQL

解决方案 »

  1.   

    最后加两个引号的话报错:
    '001F785-0000-0000-0000-0000899A5A68' 之前有未闭合的引号。
    '001F785-0000-0000-0000-0000899A5A68' 附近有语法错误
      

  2.   

    SET @SQL='update '+@tableName+' set '+@fieldName+'='''+@newValue+''' where '+@tableName+'OID='''+@tableOIDValue+''' and 1=1'

    EXEC sp_executesql @SQL 这跟引号没有关系,在后面加了1=1,照样报严重异常
      

  3.   

    把@SQL的值print出来,直接执行有没有问题!