3

Can't figure out why I'm getting a syntax error with this delete statement:

DELETE FROM RawServiceNow.dbo.u_loan
LEFT JOIN RawServiceNow.stg.ServiceNowDeletes ON 
RawServiceNow.stg.ServiceNowDeletes.SysId = RawServiceNow.dbo.u_loan.SysId WHERE 
ServiceNowDeltes.SysId IS NULL

Error:

Msg 156, Level 15, State 1, Line 18 Incorrect syntax near the keyword 'LEFT'.

Hadi
  • 36,233
  • 13
  • 65
  • 124
PJ.SQL
  • 343
  • 2
  • 10

1 Answers1

4

This is the correct syntax:

DELETE u
FROM RawServiceNow.dbo.u_loan u
LEFT JOIN RawServiceNow.stg.ServiceNowDeletes s 
ON s.SysId = u.SysId 
WHERE s.SysId IS NULL
forpas
  • 160,666
  • 10
  • 38
  • 76