0

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.

3
  • Where do the data in the table come from? How do you access the table? Commented Jan 8, 2021 at 12:02
  • @marsh-wiggle : I execute a script and will get the data from SQL and then will add another filed Status to check backup physical location, Commented Jan 8, 2021 at 12:11
  • Note: Null and blank are two different things Commented Jan 8, 2021 at 12:18

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.