anthony.green (1/2/2013)
Jason-299789 (1/2/2013)
so is @p_error an integer?In which case you will need to change the
IF @p_Error IS NOT NULL
SET @SQL = @SQL + 'AND RS.ERROR_CODE = ' + @p_Error+ ''
INSERT INTO @RecipientDetails
EXEC (@SQL)
to
IF @p_Error IS NOT NULL
SET @SQL = @SQL + 'AND RS.ERROR_CODE = ' + Cast(varchar(20),@p_error)+ ''
INSERT INTO @RecipientDetails
EXEC (@SQL)
and that should work.
Should be
Cast(@p_error, varchar(20))
Convert the data type is first, cast the data type is last.
Doh!!!!, thanks anthony, its my fist day back after after 14 days holiday, and the brains still warming its cache.
_________________________________________________________________________
SSC Guide to Posting and Best Practices