I'm doing an Excel import in a child table each week that's tied to a parent record for that week. Obviously, in the child (excel imported data) table, there will be multiple records for the given week's parent PK.
The problem I have, since there is no ultra-simple and quick one-liner "UPDATE" SQL (Grrrr) is that I need to update the child table's FKs in a loop after the Excel import batch process is done. That is, for each excel record imported, I need to update the FK field in the child table so it points back to the particular parent record.
Since the excel import happens in a batch and there is no simple UPDATE SQL I'm left with, as I understand what's possible, having to know the first record PK value imported and, after the import, going to the bottom, and getting (in a variable) the last PK value imported.
Then I can set up a loop to update each FK field in the child table so it correctly points back to the parent.
Now, since the PK field in the child table is auto-incrementing, from import to import, I have no idea what the PK value currently is without some help.
it looks like the GetNextSerialValue is what I want, but it doesn't return anything. If I go into the database, I can easily see that for the child table's PK there is a "next value", but the command below returns nothing.
GetNextSerialValue (Get(FileName) ; CHILD_TABLE::PK_FIELD )
Would therefore appreciate any suggestions why this command does nothing.
P.S. Maybe there's a more elegant approach to my import approach?