I have a stored procedure where I Increment the sub_days value daily,
I want to add a condition where
if sub_days = 30 then sub_months=sub_months+1 and
sub_days=0
How to add this condition to my stored procedure?
My SP:
ALTER PROCEDURE [dbo].[Update_Users_With_Month]
@ID bigint
AS
BEGIN
update Subscribers_Profile
set Sub_Updated = GETDATE() , sub_days = sub_days+1
where sub_ID = @ID
**add condition here**
END
Best Answer
Something like this?
And in case you have NULLs in sub_months you can just use ISNULL in the case, like: