Set bit in Table A if values are present in Table B I have two tables, Containing up to ~10 million entries.

TableA which has 3 columns: IDA (bigint), IDB (int) and CHK (bit).
(IDA, IDB) is the primary key.

TableB which has 2 columns:  IDA (bigint), IDB (int). (IDA, IDB) is the primary key.

Now I need to set the CHK bit for every IDA+IDB that is in TableA and TableB.

Working on Microsoft SQL Server Enterprise Edition v9.00.3042.00,
 i.e. SQL Server 2005 Service Pack 2
update a 
    set a.CHK = 1
from tableA a 
join tableB b
    on b.IDA = a.IDA and b.IDB = a.IDB