sql server - Inner Join and Coalesce issue -
i running query , getting error:
msg 102, level 15, state 1, line 3
incorrect syntax near '.'.msg 4145, level 15, state 1, line 6
expression of non-boolean type specified in context condition expected, near 'and'.
my target table contains nulls , source contains nulls , data.
i need fill target addresses source table.
declare @fullstatement nvarchar(4000) set @fullstatement= ' using ' + @targettable+ ' itarget'+ ' using '+@currenttable+' isource select isource.[address], itarget.[address] isource inner join itarget on target.versionenddate null , target.researchpropertyid = source.researchpropertyid (coalesce(isource.[address], '') = coalesce(itarget.[addres], '')) , (coalesce(itarget.[address], '') = coalesce(isource.[address], ''))' if @debug = 1 print @fullstatement execute sp_executesql @fullstatement
you need change each '' '''' in block:
(coalesce(isource.[address], '') = coalesce(itarget.[addres], '')) , (coalesce(itarget.[address], '') = coalesce(isource.[address], ''))
Comments
Post a Comment