select convert(nvarchar(16), TimeLog, 120) requestTime,
count(Request) As noOfQueries
from LogData
where TimeLog between @StartDate and @EndDate
group by convert(nvarchar(16), TimeLog, 120) order by requestTime;
在這裏,在where子句中Timelog
之間:2012-06-21
和2012-06-21
但我想它2012-06-21 00:00:00
之間和2012-06-21 23:59:59
因此,我想在@Satrtdate/@EndDate
轉換成以上格式,所以我想追加00:00:00
到@StartDate
和23:59:59
到@EndDate
。
爲nvarchar(16)?你的日期什麼時候會持有Unicode數據? –
@AaronBertrand感謝您的回覆。 select語句無關緊要。請你只能看到where子句。 – Rish
這就是爲什麼它是一個評論,而不是一個答案。 –