AbhisCodeStore
AbhisCodeStore

Reputation: 3

Check specific column in datatable is blank

I have a datatable like below:

   ID           DBName         Path                      Status
    1           Test          F:\Backup\test.bak
    2           Learning      F:\Backup\Learning.bak 
    3           NewTool       F:\Backup\NewToolt.bak
 

I need to verify whether the whole column 'Status' is blank or not.. If the column 'Status' is blank then I want to remove it from the datatable.

Upvotes: 0

Views: 109

Answers (1)

Ceemah Four
Ceemah Four

Reputation: 518

One of the many ways to check this would be

SELECT Status, count(*) FROM DataTable 
WHERE Status IS NOT null
GROUP BY Status

If you get back a count, then you got non-null data. Else the column is null in every row. You can use/extend the same logic for Blank values ( length = 0 ) as well

Upvotes: 1

Related Questions