title: Reset a subset of columns to their default values in SQL?
body: <p>I'm looking for a SQL statement or stored procedure to reset the values for a subset of columns in a row to their default values (where so defined) or else to null. There are other columns in the row that I don't want to reset, else I could just delete the row and create a new one which would be initialized with the various default values... that's the effect I want, but only for a particular subset of the columns.</p>
  
  <p>Conceptually, I'm looking for </p>
  
  <pre><code>UPDATE eirProj 
  SET &lt;all columns named like 'paf%'&gt; TO THEIR DEFAULT OR NULL
  WHERE prjId=@prjId
  </code></pre>
  
  <p>or at least</p>
  
  <pre><code>UPDATE eirProj 
  SET pafAuth=&lt;pafAuth default or NULL&gt;, pafComp=&lt;pafComp default or NULL&gt;, paf...
  WHERE prjId=@prjId
  </code></pre>
  
  <p>I'm trying to avoid hard-coding the default values redundantly in two places (the table definition and this reset code). Ideally but less critically I'd like to avoid hard-coding column names so it would still work if the subset changes by adding, dropping, or renaming columns.</p>
  
  <p>I'm working in SQL Server and T-SQL-specific solutions are ok if that's the only way to do this.</p>