title: How to handle null values in Sql Server like operator
body: <p>I have created a stored procedure shown below it provides all the menus based on search of 'Text' and 'MenuType' columns. </p>
  
  <p>I want to create it like if I pass  GetMenusbyTextandType '','-1' as paramters then it should show all the records of MenuMaster table. The problem is that I have some null values in 'MenuType' column, which are not reflecting in this proc.</p>
  
  <pre><code>Create proc GetMenusbyTextandType
      @Text nvarchar(400),
      @MenuType nvarchar(10)
  as
  begin
      SELECT * 
      FROM MenuMaster 
      WHERE Active = 1 
        AND [Text] LIKE '%' + @Text + '%' 
        AND MenuType LIKE 
               CASE 
                  WHEN @MenuType = '-1' 
                     THEN '%' + ISNULL(MenuType, '') + '%' 
                     ELSE '%' + @MenuType + '%' 
               END
  END
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Hl5in.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hl5in.png" alt="enter image description here"></a></p>