title: SQL Server 2012 query won't save as view
body: <p>I've got the following fully-working query in SQL Server 2012:</p>
  
  <pre><code>SELECT
      iif(((DATEPART(dw, MeasurementTime) + @@DATEFIRST) % 7) &lt; 2,'Weekend','Weekday') AS PartOfWeek,
      Seasons.Label AS Season,
      CONVERT(TIME,MeasurementTime) AS TimeOfDay,
      FeederLoads.FeederNo AS FeederNo,
      Avg(FeederLoads.kVA) AS Mean,
      StDev(FeederLoads.kVA) AS StdDev
  FROM
      FeederLoads INNER JOIN
      Seasons
      ON  Month(FeederLoads.MeasurementTime) = Seasons.Month1 OR 
          Month(FeederLoads.MeasurementTime) = Seasons.Month2 OR 
          Month(FeederLoads.MeasurementTime) = Seasons.Month3
  GROUP BY
      ((DATEPART(dw, MeasurementTime) + @@DATEFIRST) % 7),
      Seasons.Label,
      CONVERT(TIME,MeasurementTime),
      FeederLoads.FeederNo;
  </code></pre>
  
  <p>When I copy and paste the query into the SQL pane of the view definition window, however, the view fails to save.</p>
  
  <p>The error message I get is:</p>
  
  <blockquote>
    <p>Error in list of function arguments: '&lt;' not recognized. Unable to
    parse query text.</p>
  </blockquote>
  
  <p>Any ideas why?</p>