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,


dschrishuhnAsked:
Who is Participating?
 
Mark WillsConnect With a Mentor Topic 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
 
mvgeertruyenConnect With a Mentor Commented:
* 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
 
coffeeshopConnect With a Mentor Commented:
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
All Courses

From novice to tech pro — start learning today.