pradeeptp
pradeeptp

Reputation: 2151

SQL query to check blank cell in Excel

I have data in excel sheet that has two columns and 10 rows. Some of the rows for First column has blank value. Excel shows it as (blank) on putting aut filter on colunm

I am querying the excel sheet from C# 2.0 to find out if first column contains a blank.

select * from [Sheet1$] where [Myname] = \"\"";

The above query is not returning any records, so I tried the query below.

select * from [Sheet1$] where [Myname] = \" \"";

This either is not returning any rows. I also tried with value NULL in the where clause , but it is also not working.

Can anyone help me to write the correct query to check for blank fields in excel?

Thanks

Upvotes: 0

Views: 8099

Answers (1)

Chris Fulstow
Chris Fulstow

Reputation: 41902

select * from [Sheet1$] where [Myname] IS NULL

This seems to work fine using System.Data.OleDb.

Upvotes: 2

Related Questions