title: Type DATE is not a defined system type
body: <p>Trying this to cast time away </p>
  
  <pre><code>   select CONVERT(char(10), [Reg Date1], 103) [Reg Date], Regs
      from (
            select cast(SetupDateTime as DATE) [Reg Date1]
                 , COUNT(distinct ID) [Regs]
            from dbo.tbl_User
            where cast(SetupDateTime as DATE) 
                  between cast((DATEADD (dd , -7 , GETDATE())) AS DATE) 
                      and cast((DATEADD (dd , -1 , GETDATE())) AS DATE)
            group by cast(SetupDateTime as DATE)
          ) a
      order by a.[Reg Date1]
  </code></pre>
  
  <p>but I get this error </p>
  
  <blockquote>
    <p>Msg 243, Level 16, State 1, Line 1<br>
    Type DATE is not a defined system type.</p>
  </blockquote>