Re: WHERE 1=2 with performance nightmares



Hi,

Sounds like a where clause added by an api or middleware to get the field
definitions but not any records.


--
best regards
Kim Madsen
kbm@xxxxxxxxxxxxxxxxxxxxxxxxx
www.components4developers.com

www.myc4d.com - Your access to cool code
blogs.myc4d.com - Your access to code tidbits and comments

The best components for the best developers
Application server enabling technology for developers

"Sarah" <SarahBram@xxxxxxxxxxx> skrev i en meddelelse
news:46b0c565$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Recently we started seeing this "WHERE 1=2" in sql profiler trace that
even makes a lot of our sql statements invalid when there is *already* a
WHERE clause in our sql.

Here is an example copied from a trace file:
SET FMTONLY ON SELECT Col1,Col2 from Table1 WHERE Col1 = 8 and Col2 = 6
WHERE 1=2 SET FMTONLY OFF

The actual sql we wrote inside the executable for this example is:
SELECT Col1,Col2 from Table1 WHERE Col1 = 8 and Col2 = 6

Btw, some of our guys have recently tried replication feature with our
servers. Has that turned on some kind of server setting that cause all
this?

The reason we started worrying about this is, we are experiencing
performance issues like timeouts, connection losses etc.,

Thanks in advance,
Sarah
D7 + SQL Server 2000/2005
ADO with Provider=SQLOLEDB.1



.



Relevant Pages

  • RE: Multiple Access and ODBC connections
    ... We're running Access 2003, SQL 2005. ... server when we deploy a new release. ... We are linked to test SQL and Access DBs, and developers change the links to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Security - give developers read access to prod DBs
    ... > We have a test SQL 2000 server where most developers have their own SQL ... > databases on the prod SQL instance where all development databases are ...
    (microsoft.public.sqlserver.server)
  • Re: Is there any limit to Left Join ?
    ... Nah - no practical limit (the maximum tables per SELECT statement in SQL ... Server 8.0 is 256). ... BOL you'll see it's a recursive grammar. ... If you were to join a couple hundred tables in your FROM clause you'd ...
    (microsoft.public.sqlserver.server)
  • Re: MS JDBC Rowset size doubled ?
    ... Bob Horkay wrote: ... > The developers claim they are not adding the asterisk and that SQL ... > Server is. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Using CAST() in WHERE Clause hangs/slows Query
    ... When you use a column in a WHERE clause which has any function on it, SQL ... Server can NOT use index statistics to determine which is the best index to ... Wayne Snyder, MCDBA, SQL Server MVP ...
    (microsoft.public.sqlserver.server)