?
Solved

Is there a way to Select none in SQL?

Posted on 2009-05-04
4
Medium Priority
?
2,777 Views
Last Modified: 2012-05-06
Hello,

I know * selects all, so is there a similar way to SELECT none in SQL?

Thanks in advance,


0
Comment
Question by:dschrishuhn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 51

Accepted Solution

by:
Mark Wills earned 300 total points
ID: 24295896
Interesting question....

You can select <column list> from <datasource> where 1 = 2

which will give you all the <column list> but with NULL entires.

Is that what you mean ?

You can also :

select NULL from <datasource>

but in Access think it is the same as if nothing was selected - but is handy in SQL Server to test "if exists" type conditions.
0
 
LVL 6

Assisted Solution

by:mvgeertruyen
mvgeertruyen earned 225 total points
ID: 24295903
* selects all columns... Why would you want to run a query that doesn't return columns?
If you just want to return no rows you can do that with select top 0 *
0
 
LVL 7

Assisted Solution

by:coffeeshop
coffeeshop earned 225 total points
ID: 24296004
Or

SELECT 1 AS Dummy FROM <table>

to get all rows but no useful information about it.
0
 

Author Closing Comment

by:dschrishuhn
ID: 31577572
Found a workaround.  Thanks for your time and suggestions
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question