karthik parcha

karthik parcha

  • NA
  • 153
  • 92.8k

ERROR:Subquery returned more than 1 value.Please help me

Nov 1 2011 3:01 AM
ERROR:Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

DECLARE @Expiration DATETIME;
DECLARE @Signeddate VARCHAR(50);
DECLARE @TextMarketing VARCHAR(50);
    Select @Signeddate=(SELECT SCHEDULEDTIME FROM #TEMP_SB );
    SET @Expiration=(DATEADD(DAY,-1,(DATEADD(YEAR,1,@Signeddate))))
If(@Signeddate<=@Expiration)
BEGIN
    SET @TextMarketing='ACTIVE';
END
else if(@Expiration is not null OR @Expiration < GETDATE())
BEGIN
    SET @TextMarketing='INACTIVE';
END
UPDATE  #TEMP_SB SET TEXT_MARKETING_STATUS=@TextMarketing

Answers (7)