akabatman2
Programmer
Hello all,
I would like to be able to find the difference between two dates with the resulting value being the number of months, between the @start and @end Date. The resulting value would be a decimal value for use in calculating the average number of months for a contract term for instance.
Record#1:
@startdate = '1/1/2005'
@enddate = '1/15/2005'
ContractTermMonths = .5
Record#2:
@startdate = '2/1/2005'
@enddate = '4/30/2005'
ContractTermMonths = 3
I was thinking this might be a UDF that would need @DatePart(To determine if the result would be the decimal value of Months or Years or Days), @StartDate,EndDate. This way the table.startdate and table.enddate fields could be returned in a select statement against a SQL Server table and the average aggregated.
I wish I knew how to code this, I am thinking I would have to be at the DBA level to figure this one out.
Any ideas on a solution?
Any help would be much appreciated.
I would like to be able to find the difference between two dates with the resulting value being the number of months, between the @start and @end Date. The resulting value would be a decimal value for use in calculating the average number of months for a contract term for instance.
Record#1:
@startdate = '1/1/2005'
@enddate = '1/15/2005'
ContractTermMonths = .5
Record#2:
@startdate = '2/1/2005'
@enddate = '4/30/2005'
ContractTermMonths = 3
I was thinking this might be a UDF that would need @DatePart(To determine if the result would be the decimal value of Months or Years or Days), @StartDate,EndDate. This way the table.startdate and table.enddate fields could be returned in a select statement against a SQL Server table and the average aggregated.
I wish I knew how to code this, I am thinking I would have to be at the DBA level to figure this one out.
Any ideas on a solution?
Any help would be much appreciated.