0
update table_name
set ValidationSQL='update staging.Employees set IsValid=0 , ErrorType=ISNull(ErrorType,'') + 'EmployeeID is NULL' from Staging.Employees where ISNull(EmployeeID,'')='' and SourceID=@SourceID and DataFileID=@DFID'
where entityName='Employees'

I tried using double quotes before " EmployeeID is Null " that works in the update statement but when the sproc fetches the query and runs throws error which is "Incorrect statement near is" The other parameters sourceID and DFID are supplied through a sproc.

ved
  • 3
  • 3
  • Because `ErrorType=ISNull(ErrorType,'')` when `SELECT`ed would be `ErrorType=ISNull(ErrorType,')`; if you to `INSERT` *two* single quotes (`'`), then you need to *escape* *two* single quotes: `''''`. You need to *escape* **all** your single quotes. For a *single* single quotes, that would be `''`, for *two* single quotes that would be `''''`, three would be `''''''`, etc, etc. – Thom A Mar 13 '23 at 10:42

0 Answers0