I need a way to insert multiple records into 2 tables and terminate the process if any errors occur.
I have Issues and IssueActivities that I will be migrating over to another DB through a program. For every 1 Issue, there are many IssueActivities. The data doesn't match up (meaning ID's are not the same, etc.) so the program takes the Issue info from DB#1 and finds the best match or default values for DB#2. The same can be said for the IssueActivity info but again, there are several records for each Issue. Capturing and translating the data isn't the problem, it's trying to figure out how in a SP I can insert the 1 Issue record into the Issue table and insert ALL of the IssueActivity records into the IssueActivities table and perform a rollback if any of it fails.
Any ideas?
I have Issues and IssueActivities that I will be migrating over to another DB through a program. For every 1 Issue, there are many IssueActivities. The data doesn't match up (meaning ID's are not the same, etc.) so the program takes the Issue info from DB#1 and finds the best match or default values for DB#2. The same can be said for the IssueActivity info but again, there are several records for each Issue. Capturing and translating the data isn't the problem, it's trying to figure out how in a SP I can insert the 1 Issue record into the Issue table and insert ALL of the IssueActivity records into the IssueActivities table and perform a rollback if any of it fails.
Any ideas?