I get this error in this simple SQL statement when trying to retrieve a string from a table.
Msg 245, Level 16, State 1, Procedure prViewRequirements, Line 18 Conversion failed when converting the varchar value 'Cardiac Assessment Questionnaire by Dr.' to data type int.
/****** Object: StoredProcedure [dbo].[prViewRequirements] Script Date: 04/24/2013 15:44:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[prViewRequirements]
@WFRouteID int
AS
DECLARE
@DocumentDescription VARCHAR(100)
SELECT @DocumentDescription = DocumentDescription
FROM tbFollowOnTracking
WHERE WFRouteID = @WFRouteID
AND IsActive = 1
IF (@@ERROR <> 0)
GOTO ERRSP
RETURN @DocumentDescription
ERRSP:
RETURN -1
Does anyone know why?
Try this one -
You are trying to return a varchar instead of int.
Please either do
or use an output parameter (Recommended)
UPDATE - Here is the whole procedure:
Try This:
Execute the proc as shown below