sql server - Condition to COMPARE TWO DATE From parameter and ADD if it Satisfies -


this procedure , im getting from , date in procedure have check if difference between , date greater 2

if condition satisfies have add 2days in days , set todate

alter procedure [dbo].[sp_tu_avgstddev_report]  @fromdate datetime, @todate datetime, @recipecode varchar(8000), @grade varchar(10), @wcid int begin -- set nocount on added prevent result sets set nocount on; if (condition check if @fromdate - @todate  > 2) --if satisfies set @todate @fromdate+2days 

please me in figuring out...

you need used date functions this.

alter procedure [dbo].[sp_tu_avgstddev_report]  @fromdate datetime, @todate datetime, @recipecode varchar(8000), @grade varchar(10), @wcid int begin if (datediff(day,@fromdate,@todate)>2) set @todate =  dateadd(day,2, @fromdate) 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -