title: SQL Server - Creating a Schema Bound Indexed View with a current GetDate filter
body: <p>I want to create the following indexed view:</p>
  
  <pre><code>CREATE VIEW [Cic].[vwMarker] WITH SCHEMABINDING 
      AS
  
      Select
          SubId,
          marker.EquipmentID,
          marker.ReadTime,
          marker.CdsLotOpside,
          marker.CdsLotBackside,
          marker.CdteLotOpside,
          marker.CdTeLotBackside
      From dbo.Marker 
      Where dbo.Marker.ReadTime &gt;= Convert(dateTime,'10/5/2011',120)
  GO
  
  CREATE UNIQUE CLUSTERED INDEX IX_vwMarker_ReadTime_EquipmentID 
         ON Cic.vwMarker (ReadTime, EquipmentID);
  </code></pre>
  
  <p>This works fine. However, what I would really like to do is to only include rows in this view that are two days old or newer, as of the current date/time the view is queried. I can't find a way to do this because I cannot use GetDate() in the Where predicate because it is non-deterministic. In other words, I'd like to do something like this, but cannot:</p>
  
  <pre><code>Where dbo.Marker.ReadTime &gt;= Convert(dateTime,DateAdd(dd,-2,GetDate()) ,120)
  </code></pre>
  
  <p>Is there a way around this?</p>