title: SQL Server: save formulas in table
body: <p>is there a way to save formulas like the following in an SQL table ?</p>
  
  <pre><code>-- first Monday in @month of current year
  dateadd(d, datediff(d, 0, dateadd(m, @month-1, 
    dateadd(yy, datediff(yy, 0, getdate()), 6)))/7*7, 0),
  -- last Monday in @month of current year
  dateadd(d, datediff(d, 0, dateadd(m, @month, 
    dateadd(yy, datediff(yy, 0, getdate()), 6)))/7*7, -7),
  -- third Friday in @month of current year
  dateadd(d, datediff(d, 0, dateadd(m, @month-1, 
    dateadd(yy, datediff(yy, 0, getdate()), 3)))/7*7, 18)
  </code></pre>
  
  <p>I have a table with a number of countries and need to save variable dates for each of them like in the below examples. 
  These dates are simple date calculations, e.g. always the first Monday in May etc.
  So I am trying to find the best way to handle something like this where the date values change every year - needed for 5 to 10 dates for each of around 30 countries. </p>
  
  <p>I am pretty new to SQL so this is more about to find out options to handle something like this. </p>
  
  <p>Many thanks for any help and suggestions on this, Mike. </p>