Check the records of a field in SQL SERVER 2008

0

I need to know the number of records a field has in SQL SERVER 2008. If I execute the statement:

select count(*) from 'tabla'

the result that throws me is 996.561

but if I execute the sentence:

select count(e-mail) from 'tabla'

the result you throw at me is 996,561 (the same amount as if you counted all the records)

I have already reviewed the field manually and I know that many of my clients did not register their e-mail, so why does it give me the same result?

    
asked by Felipe Lujan 04.12.2017 в 22:57
source

1 answer

1

You can use the NULLIF function so that if the field is an empty string, take it as null and do not include it in your query:

    SELECT COUNT(NULLIF(email, '')) FROM 'Tabla'
    
answered by 05.12.2017 в 00:08