Tomaz Kastrun shows a great use of window functions in T-SQL:
So you have NULL values in your SQL Server table and you want to populate those NULL values with the last non-NULL value, based on a particular order. Once you have only one NULL values encapsulated between two populated values, there are quick and fast solutions. But what if you find a larger gap of NULL values and you want to populate these values as well?
Click through for a partial solution, followed by the real solution.