Question: I'm trying to figure out an easy query I can do to test if a large table has a list of entries that has at least ONE blank (NULL / empty) value in ANY column.

I need something like

```
SELECT * FROM table AS t WHERE ANY(t.* IS NULL)

```

I don't want to have to do

```
SELECT * FROM table AS t WHERE t.c1 = NULL OR t.c2 = NULL OR t.c3 = NULL

```

This would be a HUGE query.

Answer: 
There's no nice built-in syntax, but Management Studio has a couple convenient features to generate the query quickly.

In Object Explorer, drill down to the table you want, expand it, then drag the whole "Columns" folder into a blank query editor. This will add a comma-separated list of columns to the query.

Next, open up Find And Replace. Set "Find What" to `,` and set "Replace With" to `IS NULL OR` (with a leading space) then hit Replace All. You'll have to clean up the last one in the sequence by hand.

It's still ugly, but it's less labor intensive ugly.
Multiple Solutions for: some nulls, all nulls, single & multiple columns plus making it QUICK using Top 1
=========================================================================================================

If you need to test multiple columns, you could use the following:

```
Column_1 Column_2 Column_3
-------- -------- --------
1        2        NULL
1        NULL     NULL
5        6        NULL

```

**First**, test for NULLs and count them:

```
select 
    sum(case when Column_1 is null then 1 else 0 end) as Column_1, 
    sum(case when Column_2 is null then 1 else 0 end) as Column_2, 
    sum(case when Column_3 is null then 1 else 0 end) as Column_3,
from TestTable 

```

Yields a count of NULLs:

```
Column_1  Column_2  Column_3
0         1         3

```

Where the result is 0, there are no NULLs.

**Second**, let's count the non-NULLs:

```
select 
    sum(case when Column_1 is null then 0 else 1 end) as Column_1, 
    sum(case when Column_2 is null then 0 else 1 end) as Column_2, 
    sum(case when Column_3 is null then 0 else 1 end) as Column_3,
from TestTable

```

...But because we're counting non-NULLs here, this can be simplified to:

```
select 
    count(Column_1) as Column_1, 
    count(Column_2) as Column_2, 
    count(Column_3) as Column_3,
from TestTable

```

Either one yields:

```
Column_1  Column_2  Column_3
3         2         0

```

Where the result is 0, the column is entirely made up of NULLs.

**Lastly**, if you only need to check a specific column, then TOP 1 is quicker because it should stop at the first hit. You can then optionally use count(\*) to give a boolean-style result:

```
select top 1 'There is at least one NULL' from TestTable where Column_3 is NULL

select count(*) from (select top 1 'There is at least one NULL' AS note from TestTable where Column_3 is NULL) a

```

0 = There are no NULLs, 1 = There is at least one NULL

or

```
select top 1 'There is at least one non-NULL' AS note from TestTable where Column_3 is not NULL

select count(*) from (select top 1 'There is at least one non-NULL' AS note from TestTable where Column_3 is not NULL) a

```

0 = They are all NULL, 1 = There is at least one non-NULL

I hope this helps.