1
Answer

Error - Conversion failed when converting the varchar value

Deepak Tewatia

Deepak Tewatia

Sep 02
17
1

Hi

 I am getting error - Conversion failed when converting the varchar value 'SELECT MAX(docentry) FROM Department' to data type int.

ALTER PROCEDURE [dbo].[MaxDocEntry]
	-- Add the parameters for the stored procedure here
      @TableName VARCHAR(50)
	  ,@DocEntry INT OUTPUT

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SET @DocEntry = 'SELECT MAX(docentry) FROM ' + @TableName
END

 

Answers (1)