Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
daidaluus
Yak Posting Veteran
73 Posts |
Posted - 2010-04-20 : 07:42:25
|
I have the following dataid value-- ----- 1 102 NULL3 NULL4 85 NULL6 127 NULL8 NULL9 NULLHow can i get the following result?id value-- ----- 1 102 103 104 85 86 127 128 129 12or how can I update the table to have these values? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-20 : 08:57:28
|
[code]select d.id, isnull( d.value, (select top 1 value from data x where x.id < d.id and x.value is not null order by id desc) )from data d[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|