DECLARE @DATAINICIAL DATE,
@DATAFINAL DATE
SET @DATAINICIAL = '20170101'
SET @DATAFINAL = '20170110'
WHILE @DATAINICIAL <= @DATAFINAL
BEGIN
SELECT @DATAINICIAL AS 'DATA', COUNT(*) AS 'NOTAS'
FROM [NOTAS FISCAIS]
WHERE DATA = @DATAINICIAL
GROUP BY DATA
SET @DATAINICIAL = DATEADD(DAY, 1, @DATAINICIAL)
END
GO