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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Cursor to remove dup Rows & Create new column

Status
Not open for further replies.

eshie

Programmer
Joined
Jun 2, 2005
Messages
6
Location
US
Hi,

I have a large amount of data in a table that was output from source application with some duplicate column data caused by field EDIT (multiple rows) as shown below: I thought about using a cursor function, however, I don't understand enough about them to utilize this.

SOURCE DATA:
DCN LINE EDIT
NMS02339120141 1 6P01
NMS02339120141 1 PE6
NMS02339120141 1 6P02
NMS02339120141 2 6P02
NMS02339120141 2 6P01
NMS02339120141 2 PE6

I want to create a function which will go through each DCN & Line, and concatenate each EDIT code into a new field. This process should continue until it gets to the next DCN & line and continue the process. The desired output is below:

OUTPUT RESULT
DCN LINE EDIT_ALL
NMS02339120141 1 6P01, PE6, 6P02
NMS02339120141 2 6P02,6P01,PE6

Any help you can provide would be most appreciated! Thanks - Elizabeth
 
A cursor approach will be slow (especially with a large table). I suggest you read this: thread183-1159740

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top