I want to update month in my database by adding 1 month but I don't know how I want to add month in my following stored procedure query I am not good in sql kindly check it
ALTER PROCEDURE [dbo].[ChangePassword]
@password varchar(20),
@epassword varchar(50),
@username char(32)
AS
UPDATE AccountRole
SET Password = @password,
EPassword = @epassword
WHERE UserName = @username
UPDATE AccountRole
SET ExpiryDate="?"
Hhere what do I have to write to increment 1 month when query executes
Try this, no needs to use second update:
You can use dateadd.
To increment an existing value of type
DATETIME
orDATE
by one month, use:and as Oleg rightfully pointed out, assuming that your two
UPDATE
statements have the sameWHERE
condition (WHERE UserName = @username
), then you could do this in a singleUPDATE
: