sql-server – 类型DATE不是定义的系统类型
发布时间:2020-12-12 08:26:31 所属栏目:MsSql教程 来源:网络整理
导读:尝试这样做,放弃时间 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,GE
尝试这样做,放弃时间
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] 但我收到这个错误
解决方法您正在使用SQL Server 2005或更早版本.数据类型 date在SQL Server 2008中引入.尝试将其转换为 datetime.看一下关于如何从datetime中删除时间部分的这个问题. Best approach to remove time part of datetime in SQL Server (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |