内部加入和合并问题

时间:2016-08-29 02:57:48

标签: sql-server

我正在运行此查询并收到错误:

  

Msg 102,Level 15,State 1,Line 3
  '附近的语法不正确。'。

     

Ms 4145,Level 15,State 1,Line 6
  在预期条件,接近'和'的上下文中指定的非布尔类型的表达式。

我的目标表包含NULL,源包含NULL和数据。

我需要使用源表中的地址填充目标。

DECLARE @FullStatement nvarchar(4000)
SET @FullStatement= ' Using ' + @TargetTable+ ' AS itarget'+
                            ' USING '+@CurrentTable+' AS isource

SELECT 
    isource.[Address], itarget.[Address]
FROM 
    isource 
INNER JOIN 
    itarget ON target.VersionEndDate IS NULL 
            AND target.ResearchPropertyId = source.ResearchPropertyId
     (coalesce(isource.[Address], '') = coalesce(itarget.[Addres], '')) and 
     (coalesce(itarget.[Address], '') = coalesce(isource.[Address], ''))'

IF @debug = 1 
   PRINT @FullStatement

EXECUTE sp_executesql @FullStatement

2 个答案:

答案 0 :(得分:0)

你需要改变每个''到'''''在这个块中:

 (coalesce(isource.[Address], '') = coalesce(itarget.[Addres], '')) and 
     (coalesce(itarget.[Address], '') = coalesce(isource.[Address], ''))

答案 1 :(得分:0)

缺少<script> $(document).ready(function(){ $('#cause_desc').summernote({ height: 300, // set editor height minHeight: 150, // set minimum height of editor maxHeight: 350, // set maximum height of editor placeholder: 'Write here...', }); }); </script> AND

single quotes
相关问题