I need to retrieve the quantity of product with price between 0 and 10. There is an error in the @W_NUM variable of the select command.
BEGIN TRANSACTION;
DECLARE @W_P1 int;
DECLARE @W_P2 int;
DECLARE @W_NUM int;
set @W_P1=0;
SET @W_P2=10;
SET @W_NUM=0;
BEGIN
WHILE (@W_P2<300)
SELECT COUNT(P_CODE)INTO @W_NUM FROM PRODUCTT WHERE P_PRICE>@W_P1 AND P_PRICE<@W_P2;
PRINT('EXISTEM'+@W_NUM+'PRODUTOS COM O PRECO ENTRE'+@W_P1+' E '+@W_P2)
@W_P1=@W_P1+1;
@W_P2=@W_P2+50;
END
COMMIT