I have a table with a named column but no rows.
Col1
I wanted to write a select similar to:
SELECT TOP(1)
NULLIF(Col1, '')
FROM table
I wanted to get a result like:
Col1
1 NULL
But instead I get just the Col1 name and no results. How can I get a table with NULL as the result?
TOPwithout anORDER BYwill return arbitrary rows. They could easily be different every time you run the query. Are you saying you want a random value in the columnCol1from your tabletable?