Home Forums SQL Server 2008 SQL Server 2008 - General Error Conversion failed when converting the varchar value 'SELECT in sql server 2008 RE: Error Conversion failed when converting the varchar value 'SELECT in sql server 2008

  • Either change the error code variable to a varchar or convert the variable when appending it to the string using cast or convert.

    SET @SQL = @SQL + 'AND RS.ERROR_CODE = ' + CONVERT(VARCHAR,@p_Error)+ ''

    As SQL is trying to convert the whole string to a number which is cannot do, so you need to make the number a string.