Hello Im using SQL2000 so I build a Dynamic Query and in the last case I have this :
IF (@apepac is not null and @nompac is not null and @month is not null )
SELECT @DynaSQL_1= @DynaSQL_1 + ' AND PACIENTE.apellidos like ''' + @apepac + '%'''+
' AND PACIENTE.nombres like ''' + @nompac + '%'''+
' AND DATENAME(MONTH,honorariotecnologo.fechaestudio) = ''' + @month +'''' +
' AND YEAR(honorariotecnologo.fechaestudio) = '+@year+''
so the parameter @year is declared in this way :
DECLARE @year int,
and the error I get from SQL output is :
Msg 245, Level 16, State 1, Line syntax
43Error to convert the nvarchar value '
What could be wrong?
Thanks!
By the way, Why if the parameter is declared as INT, on the body query it must have to be casted / converted? ...