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

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Why do we use WHERE 1 = 1 in the queries?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-27 : 08:29:59
Prathiba writes "Why do we use WHERE 1 = 1 in the queries?"

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2005-06-27 : 08:36:19
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?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-27 : 09:03:27
Yes
It is equivalent to Select columns from table
To get only structure and not data Select Columns from table where 1=0

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -