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 |
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2007-04-17 : 06:06:26
|
Hello all,SELECT * FROM table WHERE 1=0what this clause exactly means WHERE 1=0what type of output i will get.Plz make me understandSwati |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-17 : 06:27:46
|
Did you try it?What result did you get? What happened in Query Analyzer or SSMS?Peter LarssonHelsingborg, Sweden |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-17 : 07:12:17
|
What will you get when where condition is not satisfied? MadhivananFailing to plan is Planning to fail |
|
|
Swati Jain
Posting Yak Master
139 Posts |
Posted - 2007-04-17 : 07:39:13
|
Hi Peso,I tried it in query analyzer but i got no records satisfying querywhat does such type of query mean?Select * from table where 1=0 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-17 : 07:41:23
|
Yes you did!You got all records who fulfilled the query filtering.Please think!What will you get when you writ1) select * from table where lastname = 'smith'2) select * from table where id = 13) select * from table where 1 = 0Peter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-17 : 07:46:24
|
This query as you posted it, has no practical usage what-so-ever. However, below query is used to create a copy of table without copying its data:SELECT * INTO #tempfrom SomeTableWhere 1=0 Not a good practice, though!Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-17 : 11:41:05
|
quote: Originally posted by Swati Jain Hello all,SELECT * FROM table WHERE 1=0what this clause exactly means WHERE 1=0what type of output i will get.Plz make me understandSwati
It is used to get empty resultset Same asSelect top 0 * from tableMadhivananFailing to plan is Planning to fail |
|
|
ACushen
Starting Member
29 Posts |
Posted - 2007-04-26 : 13:56:18
|
Hmmm. This sounds suspiciously like a homework question... ;-)-Andrew |
|
|
|
|
|