Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3161
  • 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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