Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for existence of at least one row ... quickest method ?

Status
Not open for further replies.

brianon

Programmer
Feb 6, 2002
22
IE
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.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top