Ramco Ramco

Ramco Ramco

  • 443
  • 3.4k
  • 526.3k

Error-Must declare the table variable "@TableName"

Sep 2 2024 3:01 AM

Hi

  I am getting error - Must declare the table variable "@TableName"

CREATE PROCEDURE MaxDocEntry
	-- Add the parameters for the stored procedure here
      @TableName VARCHAR(50) = NULL
	  ,@DocEntry INT OUTPUT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	SELECT 
        @DocEntry = MAX(docentry) 
    FROM
        @TableName

END
GO

 


Answers (1)