I have a synonym created for this table ParaPITD.dbo.BM_00_PolicyMaster
that points to ParaPITDYYYYMM.dbo.BM_00_PolicyMaster
There is no table yet - so it acts as a place holder.
I have a stored procedure that creates a temp table #BM_00_PolicyMaster
and now I want to insert or select into the place holder where the synonym points to and create the table in ParaPITDYYYYMM.dbo.BM_00_PolicyMaster
If I run this:
select *
into ParaPITD.dbo.BM_00_PolicyMaster
from #BM_00_PolicyMaster
it creates the table in ParaPITD.dbo.BM_00_PolicyMaster
and ignores the synonym
If I run this:
INSERT INTO ParaPITD.dbo.BM_00_PolicyMaster
SELECT *
FROM #BM_00_PolicyMaster
it gives me an invalid object error acting like the table must exist before it will insert.
Appreciate any help - thanks