sql server - Does Transact-SQL have a similar function to MS Logparser Quantize? -


if familiar microsoft log parser recognize quantize function truncate value nearest multiple of value. quite handy grouping date-time fields increments.

date-time              count 1/1/2010 00:00         100 1/1/2010 00:15         134 1/1/2010 00:30         56 .... 

i'm trying find similar function in transaction-sql (specifically sql server 2005 or 2008) allow me similar grouping on date-time.

not directly, doesn't. can group function (that write) rounds datetime column nearest quarter-hour (or whatever quantize does).

select     dbo.quarterhour(datecolumn) date-time   , count(*) count mytable group dbo.quarterhour(datecolumn) 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -