When I run the following Procedure, SQLServer gives the error:
error Must declare the variable scalar "@VDIAPARALISADO".
Procedure:
BEGIN
SELECT @VDIAPARALISADO = COUNT(F.DATA)
FROM ED_FERIADO F
WHERE F.EDEMPRESA_ID = @PEDEMPRESA_ID
AND F.GMUNICIPIO_ID = @PGMUNICIPIO_ID
AND F.SECRETARIA_ID = @PSECRETARIA_ID
AND F.ANO = @PANO
AND F.TIPO IN ('6')
AND F.DATA BETWEEN @DT_INICIO
AND @DT_FIM
AND F.DATA NOT IN (
SELECT C.DATA
FROM ED_CALENDAR C
WHERE F.EDEMPRESA_ID = @PEDEMPRESA_ID
AND F.GMUNICIPIO_ID = @PGMUNICIPIO_ID
AND F.SECRETARIA_ID = @PSECRETARIA_ID
AND F.ANO = @PANO
AND F.DATA BETWEEN @DT_INICIO
AND @DT_FIM
AND C.TIPO_CALEN = @VTIPO_CALENDARIO
)
END