replace NULL values with latest non-NULL value in resultset series (SQL Server 2008 R2)
问题 for SQL Server 2008 R2 I have a resultset that looks like this (note [price] is numeric, NULL below represents a NULL value, the result set is ordered by product_id and timestamp) product timestamp price ------- ---------------- ----- 5678 2008-01-01 12:00 12.34 5678 2008-01-01 12:01 NULL 5678 2008-01-01 12:02 NULL 5678 2008-01-01 12:03 23.45 5678 2008-01-01 12:04 NULL I want to transform that to a result set that (essentially) copies a non-null value from the latest preceding row, to produce