I am getting error when i try to run this code.
CREATE PROCEDURE [dbo].[UPdateDatereturn] @c nvarchar(50) AS
BEGIN
DECLARE @admno nvarchar(50)
DECLARE @class nvarchar(50)
DECLARE @types nvarchar(50)
DECLARE @Rdate datetime
exec Sendtempnexterm @c
DECLARE @Sum INT = 0
DECLARE @Counter INT, @TotalCount INT
SET @Counter = 1
SET @TotalCount = (SELECT COUNT(*) FROM temp)
WHILE (@Counter <= @TotalCount)
BEGIN
SET @admno = (SELECT admno FROM (SELECT ROW_NUMBER() OVER( ORDER BY (SELECT 0)) RowId,* FROM temp) t WHERE t.RowId = @Counter)
SET @types = (SELECT stdtype FROM (SELECT ROW_NUMBER() OVER( ORDER BY (SELECT 0)) RowId,* FROM temp) t WHERE t.RowId = @Counter)
SET @Rdate = (select Dreturn FROM setdates2 where [class] like '%'+@c+'%' and studenttype=@types)
IF @types='DAY'
BEGIN
UPDATE P3P7 SET Returnsd =Convert (datetime,@Rdate,103) WHERE admno = @admno
END
ELSE IF @types='BOARDER'
BEGIN
UPDATE P3P7 SET Returnsd = Convert (datetime,@Rdate,103) WHERE admno = @admno
END
SET @Counter = @Counter + 1
CONTINUE;
END
END
Msg 512, Level 16, State 1, Procedure UPdateDatereturn, Line 18
Subquery returned more than 1 value. This is not permitted when
the subquery follows =, !=, <, <= , >, >= or when the subquery
is used as an expression.