SQL Server CE转换日期字段

时间:2014-02-02 19:10:25

标签: sql-server-ce

我刚写了以下查询:

SELECT CAST(ENTERED AS nvarchar(10)) AS DATE, ITEM_ASSIGNED, COUNT(*) AS TOTAL
FROM DataSheet
GROUP BY CAST(ENTERED AS nvarchar(10)), ITEM_ASSIGNED

我差不多了,我唯一的问题是我的输入字段显示为

Apr 1 201

我希望它显示为:

4/1/2013

如何更改此查询中的格式?我正在使用SQL Server Compact

1 个答案:

答案 0 :(得分:1)

你试过吗

SELECT   CONVERT(VARCHAR(10), ENTERED, 101) AS [DATE]  
       , ITEM_ASSIGNED
       , COUNT(*) AS TOTAL
FROM     DataSheet
GROUP BY CONVERT(VARCHAR(10), ENTERED, 101), ITEM_ASSIGNED