Gary,
There's no overhead in quering table with 'WHERE 1=2' because SQL Server can optimize it. There's also SQL Server specific approach as shown in
Re: How to return an empty result Message #
810500.
>
>I have a number of SQL server tables that are related to a parent table. The parent table has bit columns that indicate whether there is any related data in each of the child tables. On the client side, when the parent record is changed, I want to requery the child tables where I know data exists but effectively empty the child cursor(s) where I know there is no data on the SQL server. Obviously, requerying these "known" empty child tables with the apropriate parameter will result in no records being returned. However, SQL server will have to go through the process (and overhead) of querying the table(s) in question simply to find out what we knew ahead of time - there are no records.
>
>I am using SQL passthru and my framework makes provision for a dynamic WHERE clause. So, when I know there are no child records (because the parent record bit flag tells me so), I could assign a new WHERE clause of "WHERE 1 = 2". This will return an empty result set and ensure that all bound controls are "empty" and "dimmed" as they should be where their data source is empty.
>
>The question is, what kind of overhead reduction (if any) am I likely to get by asking the query to find records "WHERE 1 = 2" rather than looking through the table for records that match the view parameter value when I alread know ahead of the query that they don't exist?
>
--sb--