Running into a problem.
I have a table defined to hold the values of the daily treasury yield curve.
It’s a pretty simple table used for historical lookup of values.
There are notibly some gaps in the table on year 4, 6, 8, 9, 11-19 and 21-29.
The formula is pretty simple in that to calculate year 4 it’s 0.5*Year3Value + 0.5*Year5Value.
The problem is how can I write a VIEW that can return the missing years?
I could probably do it in a stored procedure but the end result needs to be a view.
Taking the assumption by Tom H. that what you really want is a linear interpolation and the fact that not just years, but also months are missing, you need to base every calculation on MONTH, not YEAR.
For the code below I assume that you have 2 tables (one of which can be computed as part of the view):
Following code must work (you just need to create a view based on it):