?
Solved

select if null fill in row

Posted on 2010-09-08
12
Medium Priority
?
506 Views
Last Modified: 2012-08-13
I have a ms-sql table I need to fill in the column with the repeated column value, for example
Any value thats null I would like it to repeat.


ScreenHunter-01-Sep.-08-10.21.gif
0
Comment
Question by:Seven price
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
12 Comments
 
LVL 16

Expert Comment

by:vdr1620
ID: 33627513
can you post a sample of your expected output??
0
 
LVL 9

Author Comment

by:Seven price
ID: 33627778
example from the photo is see cComments
if null then printing will fill everything above with the same line.

where dTotal 1023.96 will fill in the null under 50.67 until it reaches anything not null.

0
 
LVL 9

Author Comment

by:Seven price
ID: 33628286
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 33628352
Do you have an identity column?  Or another sequence key?  The data must be sequenced to do what you are trying to do.
0
 
LVL 9

Author Comment

by:Seven price
ID: 33628426
no but I can use a select count(*)
0
 
LVL 9

Author Comment

by:Seven price
ID: 33628580
WRITE QUERY TO REPEAT VALUE OF PREVIOUS RECORD >>
do you have example?? in a select statement not update
0
 
LVL 16

Expert Comment

by:vdr1620
ID: 33628620
are you using any order by clause ...how do you know what your result set will be

4.13  50.67  NULL
NULL NULL  Printing.......

OR

NULL NULL  Printing.......
4.13  50.67  NULL

The Order makes a lot of difference.. Count(*) will not solve the problem..

Also,What would your output be if there are 3 rows like below

1          3      Row1
NULL NULL NULL
2          4        Row3
0
 
LVL 9

Author Comment

by:Seven price
ID: 33628684
I am using a order by clause of course, there will never by 3 null rows, i just need the syntax if you can.

thanks
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 33628715
To produce the right code, the ORDER BY column(s) need to be known.
0
 
LVL 9

Author Comment

by:Seven price
ID: 33693923
>>ORDER BY column(s) need to be known
??
0
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 1500 total points
ID: 33696824
>> I am using a order by clause of course <<
>> To produce the right code, the ORDER BY column(s) need to be known. <<
>> >>ORDER BY column(s) need to be known
??<<


What are the names of the ORDER BY column(s)????

There is NO way to write code for this w/o knowing what the ORDER BY columns are!!
0
 
LVL 9

Author Closing Comment

by:Seven price
ID: 33720150
t
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question