Need to get NULL values in records as well

Can someone help me on below Query?

I am currently using below query to get status, Sometimes there are NULL status also so, IF NULL is there and not Success then follow the process.

I don’t understand how to get NULL values as well .

“select * from Records where [Current_Date] = '”+ Now.AddDays(-2).ToString(“MM/dd/yyyy”) +“’ and [status] <> ‘success’”

IF I am using this query, It is not picking up NULL vales.

1 Like

Hey @PALKUMARI_PATEL

Try adding the below condition as well,

[status] is NULL

Hope this helps

Thanks
#nK

1 Like

@PALKUMARI_PATEL Try adding the below one to your query at the end

OR [status] IS NULL
1 Like

Hey @ushu I tried with what you suggested but it is giving me row.count=5, There is 2 NULL values and 1 Failed Vaule for Status. So, It should be 3 right?

@PALKUMARI_PATEL Yes, it should be. Can you print that data table and check what is the data that contains

See below.
image

04-09 date have one failed record and it is returning still 5

@PALKUMARI_PATEL It looks like you need success, failed and null values related to a specific data, then why don’t you use only the first expression. It returns all the values

select * from Records where [Current_Date] = ‘"+ Now.AddDays(-2).ToString(“MM/dd/yyyy”)

I have to check if Failed or null values in the status column, then need to go ahead and open each of the reports on Website and download then update the status Success.

I think you used wrong letter case for filtering “Success” in the query , you have used “success” but from data screenshots it is of the form “Success”
And use the query as suggested by @ushu ,
then use filter datatable to remove the records which have “Success” and process with remaining datatable

still it is giving me wrong numbers. I want to use everything in 1 query to filter status also.

Hey , I noticed that even from my database also it is giving me wrong number if I am selecting particular date which has 2 records (1) failed (2) Null, IT is giving me total 4 records.

ok can you post the sql query that you ran on the SQL server and its output screenshot?

in the previous ss it shows 9th and 11th both date records , but according to your requirement it seems like you only need 9th ?

Hey, Thank you for supporting on issue. I got the correct records.
I am using [Status] = ‘NULL’

2 Likes

Cool @PALKUMARI_PATEL :slightly_smiling_face::+1:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.