Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how do I select null values from my SQL database?

here is my code:
C#
SQcon.Open();
 SQcmd = new SqlCommand("SELECT COUNT(*) as 'count' FROM dbo.INVENTORY WHERE INV_NO =", SQcon);



however its giving me an incorrect syntax.
I need to get INV_NO with null values.
Posted

1 solution

You have to use the keyword IS since null cannot be compared to using =

SQL
SELECT COUNT(*) as 'count' FROM dbo.INVENTORY WHERE INV_NO IS NULL
 
Share this answer
 
Comments
JB0301 4-Mar-14 20:27pm    
Thanks!
ZurdoDev 4-Mar-14 21:00pm    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900