Solved

Syntax to Insert Many Rows to One

Posted on 2008-10-15
6
208 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
[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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

740 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