.Net Query rewrites itself?

From: Guru Hippie (GuruHippie_at_discussions.microsoft.com)
Date: 12/17/04


Date: Fri, 17 Dec 2004 07:23:05 -0800

When I enter an SQL statement in an Oracle data adapter of the form:

select column1, column2
from table1
where (column1 = :column1 or :column1 is null) and
          (column2 = :column2 or :column2 is null)

Visual Studio decides by itself to rewrite the query as:

select column1, column2
from table1
where (column1 = :column1) and (column2 = :column2) or
          (column1 = :column1) and (:column2 is null) or
          (:column1 is null) and (column2 = :column2) or
          (:column1 is null) and (:column2 is null)

The rewritten query no longer works. How can I get VS to stop doing this?



Relevant Pages

  • Avoid divide zero in the where clause
    ... How would I rewrite this query for it to work. ... SELECT A, B, A/B ... FROM TABLE1 ...
    (microsoft.public.sqlserver.programming)
  • Re: Displaying row no/Record Counting
    ... EnteredOn Date/Time when the record was added. ... You create a query that contains Table1. ... On each row of your query, you need to count the number of records in Table1 ... In> order to generate an alphabetical listing of these people,> I have to analyze the report in Excel and sort the> spreadsheet based on the client's name. ...
    (microsoft.public.access.queries)
  • Re: How to add to a new field based on information in existing field?
    ... a query to join the two tables. ... For example, Table1 includes fields TestID ... Table2 includes fields Description and DescriptionFr. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Data Accuracy Database Question 1 - Checking For Duplicate Rec
    ... D JOHNSON and that string is matched in the master table with eD JOHNSON. ... Yes any query you can build that makes sense to you will work. ... >> Select the Telephone in Table1 and connect a relationship to Table11 on ...
    (microsoft.public.access.gettingstarted)
  • Re: Data Accuracy Database Question 1 - Checking For Duplicate Rec
    ... Not sure why this works but it could spot for example D JOHNSON as a record ... > Select the zip code in Table1 and connect a relationship to Table11 on zip ... > change to an append query (make sure you ... it will be identified as a duplicate record. ...
    (microsoft.public.access.gettingstarted)