mattyboy2000
Programmer
Hi
I've populated a Temporary table with the records I need to process I then want to loop through the Rows and insert into two seperate tables. I know your going to tell me to use an INSERT with a SELECT but I dont think this is possible in our case.
I use a Stored procedure called getNextNumber that increaments a field and returns the next number of the sequence. I'm using this as the Primary key for one of the tables. And part of the key in the other:
NomTrans Table - PK (RecordNo)
NomTransVal Table - PK (RecordNo, CurrCode)
Therfor I need the SAME RecordNo for both tables.
The way I access the getNextNo Function is shown below:
EXEC @NewNo = getNextNo('FieldName')
I think I need to use a cursor but I have only seen examples where one field is used.
I hope you can help and I haven't just rambled aimlesly
Thanks
Matt
I've populated a Temporary table with the records I need to process I then want to loop through the Rows and insert into two seperate tables. I know your going to tell me to use an INSERT with a SELECT but I dont think this is possible in our case.
I use a Stored procedure called getNextNumber that increaments a field and returns the next number of the sequence. I'm using this as the Primary key for one of the tables. And part of the key in the other:
NomTrans Table - PK (RecordNo)
NomTransVal Table - PK (RecordNo, CurrCode)
Therfor I need the SAME RecordNo for both tables.
The way I access the getNextNo Function is shown below:
EXEC @NewNo = getNextNo('FieldName')
I think I need to use a cursor but I have only seen examples where one field is used.
I hope you can help and I haven't just rambled aimlesly
Thanks
Matt