SQL Temp Tables & Replication
- by Refracted Paladin
I have had an issue with our replication process and would like to salvage some data. I have a process in place where I will connect to each subscriber before flagging them for reinitialization and I will run the below to pull any data they may have entered in during the "dark time".
I am pretty sure this will work in a vanilla palace. What I am unsure of is whether the Global Temporary Table will persist through DB Replication. To be clear, I am not trying to Replicate the TempTable, I just want to make sure it will still exist at the local DB after the Replication so I may run the INSERT from it.
Thoughts?
USE MemberCenteredPlan
-- Select Data from tblPLan
SELECT * INTO ##MyPlan
FROM tblPlan
WHERE PlanID = 407869
---------------------------
-- Run Replication Process
---------------------------
-- Insert Plan back into DB
INSERT INTO tblPlan
SELECT * FROM ##MyPlan
WHERE PlanID = 407869
-- Drop Global Temp Table
DROP TABLE ##MyPlan
---------------------------
-- Run Replication Process
---------------------------