Previous logic just picked any temp table it found matching the specified name (supplied via the @table_name='#tempTableName' parameter), regardless of which session it belonged to. This may have resulted in the wrong table metadata being used to construct the merge statement.
Previous logic just picked any temp table it found matching the specified name (supplied via the
@table_name='#tempTableName'
parameter), regardless of which session it belonged to. This may have resulted in the wrong table metadata being used to construct the merge statement.