![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
So now I know how to get the batch's id. I could code something like: insert into Batches ('Example Batch') declare @BatchNr int select @BatchNr=scope_identity() insert into Transactions (TrnDt,BatchNr,Account,Amount) values ('20110331',@BatchNr,'Income',-500), ('20110331',@BatchNr,'Reserves',200), ('20110331',@BatchNr,'Income Tax S/A',200) This is, of course, not something that I want in app code. I would create a stored procedure. Is the correct approach to in app code create a cursor variable, load it with the Transactions-to-be rows, and call the stored procedure with the parameters BatchName and the cursor? Is there a better way? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
You can use a long parameter list and do the math and validations in the same procedure. This will be portable code. |
![]() |
| Thread Tools | |
| Display Modes | |
| |