question

LambellaJules avatar image
LambellaJules asked

How to create multiple rows from a single row

Hi everyone I am migrating data from one crm to another and using ssis to transform then Scribe to populate the data and having trouble with one particular target entity. I'm having to make it up out of the existing Invoice data and so I have Pending and Paid invoices. Unpaid = easy. But for the part paid invoices I have to make up two new rows out of one to go into the related target entity - one for the paid bit (where amount paid goes into Value column with status of Paid), and another row for the amount remaining (where amount remaining also goes into the Value column with status of Unpaid). I've had a look at UNPIVOT but can't see how to apply it to this scenario. I may have just been looking at it too long. Any help whatsoever would be gratefully received. Many thanks, Jules
ssistsqldata-migration
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

JohnM avatar image JohnM commented ·
Any chance you can provide a table schema and some dummy data? Also, what you want the results to look like would be helpful.
0 Likes 0 ·
erlokeshsharma08 avatar image erlokeshsharma08 commented ·
As John said, we need a bit more information. However union could be handy here select amount, paid as status where union select amount, unpaid as status where and then it could be used as your source query
0 Likes 0 ·

1 Answer

·
LambellaJules avatar image
LambellaJules answered
Thank you both for responding so quickly, I've just been playing with a quick n dirty fix by creating 2 new views, one for each scenario, then doing a union on the results - seems to be working. I've no doubt it's not the best way to get the results I wanted but whatever gets me there is good for me. Thanks once again Best, Jules
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.