Must declare the scalar variable "@pList"

1

I need to pass a list of Id's to WHERE of a UPDATE , iterating and doing a UPDATE at the same time, these I get from doing INSERT to a table type TYPE with a value as type INT .

Something like this:

DECLARE @pList dbo.List
    ,@pUserAccount VARCHAR(50) = 'user@hotmail'
    ,@vCount INT;

INSERT INTO @pList (Value)
VALUES (174);

INSERT INTO @pList (Value)
VALUES (17);

SELECT @vCount = COUNT(*)
FROM @pList;

IF @vCount > 0
BEGIN
    UPDATE Tbl
    SET StatusId = 2
    WHERE Id = @pList
END

This is the error that happens to me:

  

Msg 137, Level 16, State 1, Line 24   Must declare the scalar variable "@pList".

    
asked by user42446 12.05.2017 в 23:29
source

0 answers