I got a presentation called "FechasFirmaHorometros", which is defined as
SELECT IdFormulario,
CONVERT(Date, RValues) AS FechaFirma
FROM dbo.Respuestas
WHERE ( IdPreguntas IN (SELECT IdPregunta
FROM dbo.Preguntas
WHERE
( FormIdentifier = dbo.IdFormularioHorometros() )
AND ( Label = 'SLFYHDLR' )) )
And I have a function called [RespuestaPreguntaHorometrosFecha], defined as
SELECT Respuestas.RValues
FROM Respuestas
JOIN Preguntas
ON Preguntas.Label = @LabelPregunta
JOIN FechasFirmaHorometros
ON FechasFirmaHorometros.IdFormulario = Respuestas.IdFormulario
WHERE Respuestas.IdPreguntas = Preguntas.IdPregunta
AND YEAR(FechasFirmaHorometros.FechaFirma) = @Anio
AND MONTH(FechasFirmaHorometros.FechaFirma) = @Mes
@LabelPregunta VARCHAR(MAX)
@Anio INT
@Mes INT
I keep getting this message hitting the above function when debugging another stored procedure that uses it
Conversion failed when converting date and/or time from character string.
But I can freely do things like
SELECT DAY(FechaFirma) FROM FechasFirmaHorometros
Why is this happening and how can I solve or get around it?
source
share