Return dates between days quantity [closed]

-3

I would like to know what I do:

I want a variable of type days

Then get the result of this variable and make a select between the dates counting the number of days

Any solution or example?

    
asked by anonymous 04.12.2018 / 21:03

1 answer

2

I do not quite understand, but if you want to do a procedure, try it that way.

declare @primeira_data datetime, @segunda_data datetime, @result int;
set @result:= Day(@primeira_data) - Day(@segunda_data);

There is a function that does this for you

DATEDIFF ( datepart , startdate , enddate )  

link

    
11.12.2018 / 18:57