Hi,
I am writing a Stored Procedure that must delete an entry from table A. However, Table A's key (A_id) is a foreign key in Table B.
Whats the best way to check if the value for A_id I am to find and delete from Table A, exists in Table B ?
I was thinking an EXISTS would work but that would search ALL of TableB. Is there any way to only search until you find a match to speed things up ?
Cheers,
Brian.
I am writing a Stored Procedure that must delete an entry from table A. However, Table A's key (A_id) is a foreign key in Table B.
Whats the best way to check if the value for A_id I am to find and delete from Table A, exists in Table B ?
I was thinking an EXISTS would work but that would search ALL of TableB. Is there any way to only search until you find a match to speed things up ?
Cheers,
Brian.