DECLARE @found int SET @found = CASE WHEN EXISTS (SELECT * FROM table1 WHERE field1 = myValue) THEN 1 WHEN EXISTS (SELECT * FROM table2 WHERE field2 = myValue) THEN 1 ... ELSE 0 ENDTake a look also at Re: Can stored procedures return values? Message #876903
IF EXISTS > (SELECT TOP 1 field1 > FROM table1 > WHERE field1 = myValue) >THEN > RETURN true >ELSE IF EXISTS > (SELECT TOP 1 field2 > FROM table2 > WHERE field2 = myValue) >THEN > RETURN true >ELSE > RETURN false >END IFI eventually need this to be in a stored procedure. I have to believe that only querying the minimum necessary tables is more efficient than unioning a couple the separate queries.