CREATE PROCEDURE RetornaNotas
@NUMNOTAS INT OUTPUT,
@DATAINICIAL DATE = '20170101',
@DATAFINAL DATE = '20170102'
AS
BEGIN
SELECT @NUMNOTAS = COUNT (*) FROM [NOTAS FISCAIS] WHERE DATA BETWEEN @DATAINICIAL AND @DATAFINAL
END
DECLARE @NUMNOTAS INT
SET @NUMNOTAS = 0
EXEC RetornaNotas @NUMNOTAS = @NUMNOTAS OUTPUT
PRINT @NUMNOTAS