i have payroll database NEW_JAMNAGARPAYROLL.
and two other database c0012016new_jamnagar and c0012017new_jamnagar.
c0012016new_jamnagar and c0012017new_jamnagar
has table LedgerMaster.
i have create synonim in NEW_JAMNAGARPAYROL
for LedgerMaster to use in NEW_JAMNAGARPAYRO.
Below is create syntex which i have use..
But this synonim will not work for c0012017new_jamnaga.
because i have use c0012016new_jamnaga
in create syntex.
Without specify db name synonim will give error at run time..
so how to create synonim, so that it will work for both database?
What I have tried:
USE [NEW_JAMNAGARPAYROLL]
GO
CREATE SYNONYM [dbo].[LEDGERMASTER] FOR [c0012016new_jamnagar].[DBO].[LEDGERMASTER]
GO
Erorr is :
Msg 470, Level 16, State 1, Procedure GetPayRollEmployeeByAuto, Line 18
The synonym "LedgerMaster" referenced synonym "LEDGERMASTER". Synonym chaining is not allowed.