Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Why do we use WHERE 1 = 1 in the queries?
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 06/27/2005 :  08:29:59  Show Profile  Visit AskSQLTeam's Homepage
Prathiba writes "Why do we use WHERE 1 = 1 in the queries?"

Arnold Fribble
Yak-finder General

United Kingdom
1961 Posts

Posted - 06/27/2005 :  08:36:19  Show Profile
Because we're generating the SQL and we're too lazy to write a special case for the first condition not having an AND in front of it?

Edited by - Arnold Fribble on 06/27/2005 08:36:36
Go to Top of Page

Premature Yak Congratulator

22864 Posts

Posted - 06/27/2005 :  09:03:27  Show Profile  Send madhivanan a Yahoo! Message
It is equivalent to Select columns from table
To get only structure and not data Select Columns from table where 1=0


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000