T-SQL Script to Group Data by Minute

If you are doing a mass data insert into a table and you want to know how fast is inserting data. I have created a script that groups data by minute, based in a DateTime data type field.


select
convert(varchar(20), DWSTOREDATETIME,101) as DATE ,
substring(convert(varchar(20), DWSTOREDATETIME, 108), 1, 5) as TimeMinute,
COUNT(*) AS TotalPerMin
from dbo.AP_DOCUMENTS(nolock)
where convert(varchar(20), DWSTOREDATETIME, 101) = convert(varchar(20), GETDATE(), 101)
GROUP BY convert(varchar(20), DWSTOREDATETIME,101),
substring(convert(varchar(20), DWSTOREDATETIME, 108), 1, 5)
order by substring(convert(varchar(20), DWSTOREDATETIME, 108), 1, 5) desc