title: SQL Server - check input parameter for null or zero
body: <p>I have a stored procedure for sql server 2008 like this:</p>
  
  <pre><code>create procedure test_proc
  @someval int,
  @id int
  as
  update some_table
  set some_column = ISNULL(@someval, some_column)
  where id = @id
  go
  </code></pre>
  
  <p>If the parameter <code>@someval</code> is <code>NULL</code>, this SP will just use the existing value in <code>some_column</code>.</p>
  
  <p>Now I want to change this behaviour such that if value for <code>@someval</code> is <code>0</code>, a <code>NULL</code> is stored in <code>some_column</code> otherwise it behave just the way it is doing now.
  So I am looking for something like:</p>
  
  <pre><code>if @someval == 0
  set some_column = NULL
  else
  set some_column = ISNULL(@someval, some_column)
  </code></pre>
  
  <p>I don't have the option to create a varchar @sql variable and call sq_executesql on it (at least that is the last thing I want to do). Any suggestions on how to go about doing this?</p>