Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Bigjim
Starting Member
1 Post |
Posted - 2005-12-07 : 21:25:26
|
| I created a temp table to hold ID and Discrepancy. Initially Discrepancy has a comma delimited format so I then call the function fnAcctDiscSplit which returns a table of the ID, Disc. So fnAcctDiscSplit(10, 'p,b,c', ',') returns 10 p:10 b:10 c. I then want to insert that whole table back into this/any table. Can this be done?Here is my attempt at it:Insert into #tmp(ID, Discrepancy)Select s.ID, s.Discrepancyfrom #Tmp tJOIN fnAcctDiscSplit(t.ID, t.Discrepancy, ',') as sON s.ID = t.IDThanks,Big Jim |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-08 : 01:02:20
|
| So ...from #Tmp tJOIN fnAcctDiscSplit(t.ID, t.Discrepancy, ',') as sON s.ID = t.IDis so that you can "split" the values for ALL the rows in #Tmp ??You can't do that this way. You will either have to loop round the rows in #Tmp and process then one-by-one through fnAcctDiscSplit, or create a "multi-row-split" method. You'd probably need a TALLY table to do that - here's an example:http://www.sqlteam.com/item.asp?ItemID=5857Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|