Solved

Syntax to Insert Many Rows to One

Posted on 2008-10-15
6
206 Views
Last Modified: 2012-05-05
I'm trying to select many rows of data and insert them to on row separated by spaces example:

Table1
Debtor   Invoice
1               10
1               12
1               16
2                 4
5               20

I want to select all invoice numbers for Debtor 1 which are 10,12,16 and Insert them into my Note Table.

Note
Debtor      Note
1                10 12 16

Since I have so many different Debtor's that I'm dealing with I have a cursor set up, but I don't know how to set all of those invoice numbers to 1 Variable?
0
Comment
Question by:N R
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22726514
Search for an udagg that concatenates your rows
0
 
LVL 11

Author Comment

by:N R
ID: 22731938
udagg?
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22732237
Used Defined Aggregate... you can create your own aggregate using .net
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 11

Author Comment

by:N R
ID: 22734127
yeah, if I knew .net
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 500 total points
ID: 22759277
Ups, there isn't other solution buddy
0
 
LVL 11

Author Closing Comment

by:N R
ID: 31506509
Ok, thanks.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now