Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server 2008 Query to poulate from previous record

Status
Not open for further replies.

JustATheory

IS-IT--Management
Feb 27, 2003
115
US
Greetings,
I’m working with SQL Server 2008 and need to know if there is a way to populate a field with the value from the same field in the previous record? In the table below I need to populate the empty fields with the value in the previous records:

Record 2 would also be SQL,

Records 4 &5 would be SQL2

Record 7 would be SQL3

Example
11111 SQL
11112
11113 SQL2
11114
11115
11116 SQL3
11117

Any help is greatly appreciated!
Thanks,
JustATheory
 
Are the numbers IDENTITY's and so they could skip numbers?
Is this order defined by some sort criteria in your select?

Is there a limit on how many "down" the value should fall through to?

I haz all the letters: SME, BA, QA, PM, DEV, DBA, UAT, SE, HD
 
Hi Qik3Coder,

The values should fill through to the record above the next populated value, and then populate the following null fields with that value, there is no specified limit.

The order is defined by a row number field, ordered.

The numbers in SQL2 was just to demonstrate different values, the values will be text values. Each value listed would then be filled down until the next value.

Thanks,
JustATheory
 
Look at this thread, b/c I'm not going to regurgitate it all.

thread183-1654675


Lodlaiden

I haz all the letters: SME, BA, QA, PM, DEV, DBA, UAT, SE, HD
 
Yes, there is quite a bit of stuff in there, I'll take a look at it.

Thanks for your help!
JustATheory
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top