This statement works:
However, I want to retain the value of ReferredByUserID for the next statement. Why won't this work?:
Code:
If EXISTS(select ReferredByUserID
from Referrals
where ReferredEmail = 'me@you.com')
PRINT 'YES!!!'
However, I want to retain the value of ReferredByUserID for the next statement. Why won't this work?:
Code:
DECLARE @UserID [int]
If EXISTS(select @UserID = ReferredByUserID
from Referrals
where ReferredEmail = 'me@you.com')
PRINT 'YES!!!'