title: SQL Server : stored procedure IFNULL check
body: <pre><code>Solution_id (Primary key, Int)
  Col1 (varchar)
  Col2 (varchar)
  Col3 (varchar)
  Col4 (varchar)
  Col5 (varchar)
  </code></pre>
  
  <p>I am writing a stored procedure to update this table. There are 6 input parameters for the above 6 columns.</p>
  
  <pre><code>@Attached_File1 VARCHAR(MAX),
  @Attached_File2 VARCHAR(MAX),
  @Attached_File3 VARCHAR(MAX),
  @Attached_File4 VARCHAR(MAX),
  @Attached_File5 VARCHAR(MAX),
  @Ticket_ID BIGINT
  </code></pre>
  
  <p>I want to write a SQL query which will update the table with the values specified in the input parameters. BUT I must not overwrite the attachment columns with null. I mean I need to use only those parameters which contains data.</p>
  
  <p>For example, if the table has a row</p>
  
  <pre><code>[10, "aaa", "bbb", "efg", null, null] 
  </code></pre>
  
  <p>and the input parameters are </p>
  
  <pre><code>(10, null, null, "mno", "ddd", null) 
  </code></pre>
  
  <p>then after the update the row will become </p>
  
  <pre><code>[10, "aaa", "bbb", "mno", "ddd", null]
  </code></pre>
  
  <p>How to check for null/empty strings and generate the update query accordingly to achieve this?</p>