Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SQL Syntax for comparing several columns

$
0
0

Hi all,

I have a table that I need to compare several columns to se if they are blank. An easy way to do this would be:

select 'a is Blank' as Rule, ID
from Customers
where a=''

union all

select 'b is blank' as Rule, ID
from Cusomters
where b=''

union all

...And so on.

But since I have like 15 columns, I'm thinking it would be a better, more good looking, way to to this? Anyone that can help me?




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>