Hi Gurus,
This is my first post here and I am new to SQL Server as well. The issue that I am facing is this. I ahve been assigned a legacy sql project. There is a table in the databse that has the output as:
col1 col2 col3 col4 col5 col6
NULL 123 NULL 321 NULL qwjk
dg NULL hghy NULL qwh NULL
NULL eyde NULL hggwd NULL qjwh
seu NULL qw NULL ygd NULL
.
.
.
and so on
as you can observe, each row has a NULL value and an actual value. The source query is inputting a null value and then an actual value(maybe sum() aggregate function is being used earlier in the source query). The actual output should be
col1 col2 col3 col4 col5 col6
dg 123 hghy 321 qwh qwjk
seu eyde qw hggwd ygd qjwh
.
.
and so on
I am planning to use a cursor, derieving each value of a column from each row and updating the NULL value with the actual value. Is there any better way to do so, I have seen deppressing comments about usage of cursors in SQL queries.
Happy coding,
Sachin