<p>I have an SQL server database that I am querying and I only want to get the information when a specific row is null. I used a where statement such as:</p>

<pre><code>WHERE database.foobar = NULL
</code></pre>

<p>and it does not return anything. However, I know that there is at least one result because I created an instance in the database where 'foobar' is equal to null. If I take out the where statement it shows data so I know it is not the rest of the query.</p>

<p>Can anyone help me out?</p>

[{'answer_id': 28924, 'author': 'bdukes', 'author_id': 2688, 'author_profile': 'https://Stackoverflow.com/users/2688', 'pm_score': 4, 'selected': True, 'text': '<p>Correct syntax is WHERE database.foobar IS NULL.  See <a href="http://msdn.microsoft.com/en-us/library/ms188795.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms188795.aspx</a> for more info</p>\n'}, {'answer_id': 28929, 'author': 'Farinha', 'author_id': 2841, 'author_profile': 'https://Stackoverflow.com/users/2841', 'pm_score': 1, 'selected': False, 'text': '<p>Is it an SQL Server database?\nIf so, use <code>IS NULL</code> instead of making the comparison (<a href="http://msdn.microsoft.com/en-us/library/aa933227(SQL.80).aspx" rel="nofollow noreferrer">MSDN</a>).</p>\n'}, {'answer_id': 28930, 'author': 'SQLMenace', 'author_id': 740, 'author_profile': 'https://Stackoverflow.com/users/740', 'pm_score': 2, 'selected': False, 'text': '<p>Read <a href="http://wiki.lessthandot.com/index.php/SQL_Server_programming_Hacks_-_Testing_for_Null_Values" rel="nofollow noreferrer">Testing for Null Values</a>, you need IS NULL not = NULL</p>\n'}, {'answer_id': 28966, 'author': 'Mark Harrison', 'author_id': 116, 'author_profile': 'https://Stackoverflow.com/users/116', 'pm_score': 2, 'selected': False, 'text': '<p>Comparison to NULL will be false every time.  You want to use IS NULL instead.</p>\n\n<pre><code>x =  NULL      -- always false\nx &lt;&gt; NULL      -- always false\n\nx IS NULL      -- these do what you want\nx IS NOT NULL\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/28922', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2486/']