Overe here we will check how old the account is
we will pass the account number and check store the account creation date and check with the current date using the date diff function of sql
ALTER proc checkmonths
(
@accountno int
)
as
begin
declare @creationdate datetime;
declare @Monthcount varchar(3);
declare @finaldate varchar(25);
declare @months varchar(3);
set @creationdate =(select accountcreationdatetime from bankinfo where accountno = @accountno)
set @finaldate= (select Convert (varchar(25),@creationdate,105))
set @months=(select datediff(month,@finaldate,getdate()))
select @months 'months'
end