Ignoring Timestamps for Accounts in SQL Server 2005

I had a problem figuring out what, in my opinion, would be a simple request. I have a table with two fields (EntryDateTime, Message), which, as you might guess, write specific messages with a date stamp for a monitoring application.

I am looking to get the number of all type messages per day, but the temporary part of the stamp (although this is necessary for everything else), giving me problems here.

I was looking for something like:

SELECT COUNT(Message)
FROM DBName.dbo.TableName
WHERE Message = 'LoginFailed'
GROUP BY EntryDateTime

What I am looking for as a result is similar to

2009-06-26, 142

2009-06-27, 259

2009-06-28, 57

Of course, this gives me more messages than

2009-06-26 00:01:01, 11

2009-06026 00:01:02, 12

. , , 365 BETWEEN.

+3
2

, - :

SELECT COUNT (Message), CONVERT(DATETIME, CONVERT(CHAR(10), EntryDateTime, 101))  
FROM DBName.dbo.TableName  
WHERE Message = 'LoginFailed'  
GROUP BY CONVERT(DATETIME, CONVERT(CHAR(10), EntryDateTime, 101))  
+2

:

SELECT DATEADD(dd, DATEDIFF(d, 0, Getdate()), 0)

Getdate() .

fooobar.com/questions/17191/...,

0

Source: https://habr.com/ru/post/1723230/


All Articles