The information in this article applies to:
SYMPTOMS
If one of the SELECT statements is against an empty tableA query that
issues an IF EXISTS statement with an OR clause can process incorrectly.
The basic logic looks like:
If table1 is empty and table2 has a row that matches the select, the statement should return TRUE; however, it returns FALSE. If a row is added to table1, even though it does not meet the search criteria, the IF EXISTS statement will process correctly. CAUSESQL Server is not correctly evaluating the IF statement when one or more of the tables has no rows. WORKAROUND
This problem can be avoided by making sure that both tables contain at
least one row. An alternate method is to restructure the IF statement
to evaluate one of the EXISTS at a time. In the example given above,
it would look like the following:
STATUSMicrosoft has confirmed this to be a problem in SQL Server version 4.2. Additional query words: transact-SQL Windows NT
Keywords : kbprg kbSQLServ kbbug4.20 SSrvServer SSrvWinNT |
Last Reviewed: November 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |