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 |
|
Trudye
Posting Yak Master
169 Posts |
Posted - 2009-07-30 : 11:49:43
|
| I have files coming from several clients, the trailers rec count has to be validated against the detail record count. Each client may send as many files as needed. I am using a For Each loop to pull the files in. I have defaulted a run_date (as current date) into the both hdr recs and dtl recs. I am also storing the filename in each record so I can tell which detail goes with which trailer. Using a Derived Col task I am inserting a 1 byte field to id the client or origin (ie. F = FAO Schwartz). Based on that I am counting the number of occurrences for each client in my procedure and using a While loop to read and validate each trailer. The problem is after processing the first trailer how do I move to the second trailer?I guess I could use a Cursor. OR is it possible to add a derived column and add a sequence number to each hdr as it is read in? For instance use a variable in my pkg assign the variable the value of 0 and each time a trailer is read add 1 to the variable and place that value in the Derived Col.I hope that all made sense.Thanks,Trudye |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-07-30 : 12:04:13
|
| I'm assuming you are using SSIS... Can you just nest your loops? You can use a variable and increment that for each loop if needed, assuming I'm following you correctly. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|