title: How do I Index this View Properly?
body: <p>I have a table similar to this:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE dbo.SomeTable (Work_ID VARCHAR(9));
  </code></pre>
  <p>I need to be able to run the following query and unfortunately can not change the data type of the Work_ID column:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT Work_ID
  FROM dbo.SomeTable
  WHERE WorkID &gt;= 100 AND WorkID &lt;=200
  </code></pre>
  <p>This of course will give me an implicite conversion and cause a table scan (several million rows).</p>
  <p>My thought was to put the following indexed view on it.</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE VIEW [dbo].[vw_Work_ID]
  WITH SCHEMABINDING AS
          SELECT  CAST(q.Work_ID as INT) as Work_ID 
          FROM dbo.SomeTable q
  GO
  CREATE UNIQUE CLUSTERED INDEX [cl_vw_Work_ID] ON [dbo].[vw_Work_ID]
  (
      [Work_ID] ASC
  )
  GO
  </code></pre>
  <p>When I now run</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT Work_ID FROM dbo.vw_Work_ID WHERE WorkID &gt;= 100 AND WorkID &lt;=200
  ``
  I still get IMPLICIT CONVERSION and a table scan.  Any solutions?
  </code></pre>