There is a table variable and a table.
How to leave in a variable only those rows that are missing in the table (using linking tables by a set of fields)?
I use for this merge :
merge @re tar using (select Hash, TypeID from Hashes) src on tar.Hash = src.Hash and tar.TypeID = src.TypeID when matched then delete ; select * from @re Not sure if this is the best option.
Purpose: use the interface for the application to check a small list on a large table in the database for presence in the database and continue processing in the program for missing values. (I don’t want to unload the entire table)
^. In Boolean algebra, Cho, this inequality<>for all sql. - nick_n_aselect * from @re tar left join Hashes src on tar.Hash = src.Hash and tar.TypeID = src.TypeID where src.Hash is null? In general, execution plans should be compared - Mike