title: Count (Distinct ([value)) OVER (Partition by) in SQL Server 2008
body: <p>I have written this and successfully executed in Oracle</p>
  
  <pre><code>COUNT (DISTINCT APEC.COURSE_CODE) OVER (
                                              PARTITION BY s.REGISTRATION_NUMBER
                                              ,APEC.APE_ID
                                              ,COV.ACADEMIC_SESSION
                                              ) APE_COURSES_PER_ACADEMIC_YEAR
  </code></pre>
  
  <p>I'm trying to achieve the same result in SQL Server (our source database uses Oracle but our warehouse uses SQL Server).</p>
  
  <p>I know the distinct isn't supported with window functions in SQL Server 2008 - can anyone suggest an alternative?</p>