Adjust column values with adjacent cell values

Hello,
I would like to know a better way of attaining this solution by writing sql query and with no temp table involved. I use CTE but I could not arrive at the solution, 1 screenshot is the current result and next screenshot is the expected result

I have the current result as per the image given with 7 column and null values here and there
I need an output as per the attached image. No null values should be in between and those values should be replaced by adjacent cell values.
LVL 36
Loganathan NatarajanLAMP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Can we use a temporary table to build the result?

I'm thinking 2 possible approaches:

1. Load the original table into a temp table, and then do a series of update statements to update the values
2. use a series of "case when" clause in the select statement to return the result we expected

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Loganathan NatarajanLAMP DeveloperAuthor Commented:
Thanks Ryan,

I thought of that way of having temp table and make the update accordingly to fetch the data as I need. But I would like to know is there any other sql Function to set this right in the query itself.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.