IF OBJECT_ID('TABELANOTAS','U') IS NOT NULL
DROP TABLE TABELANOTAS
CREATE TABLE TABELANOTAS (DATA DATE, NUMNOTAS INT)
DECLARE @DATAINICIAL DATE = '20170101'
DECLARE @DATAFINAL DATE = '20170110'
DECLARE @NUMNOTAS INT
WHILE @DATAINICIAL <= @DATAFINAL
BEGIN
SELECT @NUMNOTAS = COUNT(*) FROM [NOTAS FISCAIS]
WHERE DATA = @DATAINICIAL
INSERT INTO TABELANOTAS (DATA, NUMNOTAS)
VALUES (@DATAINICIAL, @NUMNOTAS)
SELECT @DATAINICIAL = DATEADD(DAY, 1, @DATAINICIAL)
END
SELECT * FROM TABELANOTAS