The "null"-check is relevant for unionability-checks.
The #{name} is syntax-sugar in mssql to create a temp table. It is dropped after the session ends by the dbms.
A key is invalid when the unioned table contains different rows with the same key. (SQL-UNION is implemented as a SET-Operation)
Because of the LEFT OUTER JOIN and the WHERE-Clause only those rows from the referencing table are selected, which are missing in the referenced table and are therefore violating the Inclusion-Dependency.
Generated using TypeDoc
This also checks if table and schema exist in database.