Every week I want to repopulate a table by doing something along the lines of:
TRUNCATE TABLE tblA
INSERT INTO tblA SELECT ... FROM tblB
That works fine (and takes under five minutes) but we also have an automatic process running that sends data from a view looking at tblA to another server. We don't know when this process will run so need to be sure that tblA will always be populated and that this process doesn't kick off in between the TRUNCATE and the INSERT or halfway through the INSERT etc.
Is it as simple as putting the TRUNCATE/INSERT into a transaction? If so, in the extremely unlikely event that the automatic process kicks off, will it just wait until the transaction completes and the tblA is populated?
MCSA SQL Server 2012