Bulk import of data spanning tables?

  • I am about to place a large number of records into a SQLserver database and it is spread over multiple tables. The data defines events and given locations, the information being obtained from a number of sources. [tblEvent, tblSource and tblLocation.] An event must have a source and location in their respective tables. So far so good. My problem comes when I need to add events in the future. Small numbers of events can be added through a forms front-end. However, when I need to add large numbers - how do I procede?

    If I have a few hundred / thousand items to add - each record giving event, location and source - how do I ensure that the sources and locations are added as necessary?

    One approach I've considered is to input the data in a temporary table then have a query looking for new locations / sources so as to add them to their respective tables. Then another query adds the main event data. On success, the temporary table is deleted. Is there a better way?

  • I like your solution. That is how I would handle it... load the data into a staging table first. Check for new sources and insert them as necessary, then insert the detail data.

    The probability of survival is inversely proportional to the angle of arrival.

  • Thank you for your support. All I have to do now is implement it 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply