title: SQL Server: Return NULL: SELECT * FROM table WHERE field LIKE '%'
body: <p>Hello and thank you in advance for helping out a noob. I tried a few different search and could not find an example where <code>%</code> is the alternate value so I apologize if this is a duplicate thread.</p>
  
  <p>My data looks like this   </p>
  
  <p>Table Name = <code>stored_item</code></p>
  
  <pre><code>Item  |  Location |  Hu  
  ---------------------------
  K134  |  LOC01    |  LP1  
  K125  |  LOC02    |  LP2  
  K345  |  LOC03    |  
  K939  |  LOC05    |  LP5
  K235  |  LOC05    |  LP5  
  </code></pre>
  
  <p>I need to query the table and need to return results based on where clause on the <code>Hu</code> column.</p>
  
  <p>Code looks like this: Where x can be any value for Hu or % to indicate search for all values (including null values)</p>
  
  <pre><code>DECLARE @hu nvarchar(15)
      SET @hu = 'X'
  
  SELECT Item, Hu
  FROM stored_item
  WHERE Hu LIKE @hu 
  </code></pre>
  
  <p>If X = 'LP5' then results should look like this:</p>
  
  <pre><code>Item  |  Location |  Hu  
  ---------------------------
  K939  |  LOC05    |  LP5
  K235  |  LOC05    |  LP5 
  </code></pre>
  
  <p>IF X = '%' Then results should look like this:</p>
  
  <pre><code>Item  |  Location |  Hu  
  ---------------------------
  K134  |  LOC01    |  LP1  
  K125  |  LOC02    |  LP2  
  K345  |  LOC03    |  
  K939  |  LOC05    |  LP5
  K235  |  LOC05    |  LP5  
  </code></pre>