title: Alternative for percentile_cont in sql server 2008
body: <p>In Oracle it works well ......</p>
  
  <p>Query for oracle is As Follows</p>
  
  <pre><code>Select distinct channel_id, position_id,datamonth, 
      percentile_cont(.9) within group (order by TRIM_PRE_ELIG_PAY) 
        over (partition by channel_id, position_id, datamonth) as TRIM_PRE_ELIG_PAY_90th_PERC 
  from Tablename
  </code></pre>
  
  <p>But for SQL Server, I'm getting an error. Here's the query for SQL Server 2008:</p>
  
  <pre><code>Select
     distinct channel_id,
     position_id, datamonth, 
     percentile_cont(.9) within group (order by TRIM_PRE_ELIG_PAY) 
       over (partition by channel_id) as TRIM_PRE_ELIG_PAY_90th_PERC 
  from table
  </code></pre>
  
  <blockquote>
    <p>ERROR: Select could not be parsed correctly. Output could not be
    generated.</p>
  </blockquote>
  
  <p>I got to know that it can work properly in SQL Server 2012 but need an alternative way in SQL Server 2008</p>
  
  <p>Can anybody help...........</p>