THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Denis Gobo

SQL Teaser: Missing FROM

Take a look at this code, will the select return anything or not? Look at the subquery and notice that there is no FROM there.

 

USE tempdb

GO

CREATE TABLE TestQuery (TestID int)

GO

 

SELECT * FROM information_schema.columns

WHERE column_name =( SELECT column_name

WHERE column_name = 'TestID')

Published Friday, January 09, 2009 2:30 PM by Denis Gobo
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Tim said:

Yes

January 9, 2009 2:30 PM
 

Adam Machanic said:

January 9, 2009 2:59 PM
 

Aaron Alton said:

That looks familliar, Denis.  It does make you do a double-take, doesn't it? ;)

January 9, 2009 3:07 PM
 

Denis Gobo said:

Adam,

haha someone put that on connect  :-) Next up  = NULL doesn't return any NULLs

Itzik Ben-Gan had a variation on this in SQL Mag 2 years (or 3) ago as a puzzle

I also made a post about it here a while back http://sqlservercode.blogspot.com/2007/04/you-should-never-use-in-in-sql-to-join.html

January 9, 2009 3:08 PM
 

Denis Gobo said:

Aaron, I got bit by this a while back, since then I always use EXISTS or test the subquery first

January 9, 2009 3:10 PM
 

Alexander Kuznetsov said:

January 9, 2009 3:11 PM
 

Adam Machanic said:

Aaron: I just commented on your CTE Connect item...

January 9, 2009 3:22 PM
 

Adam Machanic said:

Actually, Denis and Alex, you might both be interested in this one as well:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=392152

January 9, 2009 3:25 PM
 

Aaron Alton said:

Adam,

Thanks for commenting - I responded on Connect as well, with some further discussion.

Being as you seem to have a second residence at Connect... ;)

Is there any way to "sign up for alerts" on your connect items?

January 9, 2009 4:05 PM
 

Adam Machanic said:

Aaron,

Not that I know of.  There are watchlists and I use them pretty heavily, but that's about it.  Connect is frustrating in lots of different ways... Just wait until your item gets closed as "Fixed" even though it's not :(

January 10, 2009 10:31 AM
 

AaronBertrand said:

Or "Won't Fix" with no explanation.  Or the worst is "By Design" with no explanation.

January 10, 2009 3:04 PM
 

Aaron Alton said:

@Adam - already got one of those....a very minor issue, but it's annoying nontheless.  I'd much rather "won't fix" than "fixed", when it's not.  At least I don't feel like I'm on the wrong side of the rabbit hole that way.  

@Aaron - I guess that the only appropriate response would be to keep changing it back to "active" with no explanation ;)

January 10, 2009 8:21 PM
 

AaronBertrand said:

I tried that on a couple, and it seems that once they are in the "won't respond" state, there is some kind of trigger that sets their state back to closed.  Both times, within minutes, they were closed again.

January 11, 2009 5:18 PM
 

Aaron Alton said:

I think that you must have had a trigger-happy respondent who happened to be online at the same time.  I set this (very inconsequential) one back to "Active" on the 5th, and it's still "Active":

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=341581

Granted,there's no response, but at least it's active!

January 11, 2009 6:32 PM

Leave a Comment

(required) 
(required) 
Submit

About Denis Gobo

I was born in Croatia in 1970, when I was one I moved to Amsterdam (and yes Ajax is THE team in Holland) and finally in 1993 I came to the US. I have lived in New York City for a bunch of years and currently live in Princeton, New Jersey with my wife and 3 kids. I work for Dow Jones as a Database architect in the indexes department, one drawback: since our data goes back all the way to May 1896 I cannot use smalldates ;-( I have been working with SQL server since version 6.5 and compared to all the other bloggers here I am a n00b. Some of you might know me from http://sqlservercode.blogspot.com/ or even from some of the newsgroups where I go by the name Denis the SQL Menace If you are a Tek-Tips user then you might know me by the name SQLDenis, I am one of the guys answering SQL Questions in the SQL Programming forum.

This Blog

Syndication

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement