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.
Author |
Topic |
joseln
Starting Member
11 Posts |
Posted - 2007-11-26 : 04:50:38
|
Hi i am fresher in IT, pls kindly let me know the difference between "Where 1=0" and "Where 1=1" which we use in SQL QueryThanks |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-26 : 04:52:25
|
"1=0" will return FALSE "1=1" will return TRUEwhen you used that in the WHERE clause, the statement will always be TRUE (1=1) or FALSE(1=0) KH[spoiler]Time is always against us[/spoiler] |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-11-26 : 04:54:25
|
Its simple comparison logic. 1=0 will always return False and 1=1 always returns True. Normally Where 1=0 is used to extract just table structure like column names from table to create its replica. 1=1 might be used to generate an uncondition while loop.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-26 : 04:55:35
|
moved from article discussion_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-26 : 05:17:13
|
To retreive table structure, you can also useSelect top 0 * from table_nameMadhivananFailing to plan is Planning to fail |
 |
|
georgev
Posting Yak Master
122 Posts |
Posted - 2007-11-26 : 05:54:45
|
Or indeed[CODE]SET FMTONLY ONSELECT * FROM tableNameSET FMTONLY OFF[/CODE] George<3Engaged! |
 |
|
|
|
|