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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Derived Column

Author  Topic 

Trudye
Posting Yak Master

169 Posts

Posted - 2009-07-31 : 12:27:48
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.
Thanx,
Trudye

X002548
Not Just a Number

15586 Posts

Posted - 2009-07-31 : 13:21:27
CROSS POST

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=130353



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -