• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3280
  • Last Modified:

Is there a way to Select none in SQL?

Hello,

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

Thanks in advance,


0
dschrishuhn
Asked:
dschrishuhn
3 Solutions
 
Mark WillsTopic AdvisorCommented:
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
 
mvgeertruyenCommented:
* 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
 
coffeeshopCommented:
Or

SELECT 1 AS Dummy FROM <table>

to get all rows but no useful information about it.
0
 
dschrishuhnAuthor Commented:
Found a workaround.  Thanks for your time and suggestions
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now