I’m making a stored procedure where several table inserts and updates are dependent on the inserts before them. Do I need to do anything to ensure those operations finish, ( like a commit), or are inserts in a stored procedure calls always done and completed in order and I’m worrying about nothing?
I’m making a stored procedure where several table inserts and updates are dependent on
Share
You’re worrying about nothing, the only scenario where you would need to be concerned is if say you were creating a permanent table (non-temp/non-variable table) and were going to do inserts into it afterwards. To get past the run-time error indicating the table does not exist you would have to put a “GO” after the table creation, but before the record insertion. You can always use a “GO” command to ensure all procedural commands up to that point are completed before proceeding with any code thereafter, but it is not necessary in most scenarios. If you perform an insert and then perform an update immediately after the update logic should not be evaluated until after the insert has completed, but if you want to be extra extra sure simply pop in a “GO” in between them and then there can be no doubt.