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?
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?
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 )