Click here to Skip to main content
16,023,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 6-Apr-17 7:27am
v3
Comments
CHill60 6-Apr-17 8:31am    
I presume the error is along the lines of "this synonym already exists?"

1 solution

Quote:
The synonym "LedgerMaster" referenced synonym "LEDGERMASTER". Synonym chaining is not allowed.

Based on that error message, [c0012016new_jamnagar].[DBO].[LEDGERMASTER] is already a synonym.

You can't create a synonym that points to another synonym.

You'll need to change your CREATE SYNONYM script to point to the same source as the [c0012016new_jamnagar].[DBO].[LEDGERMASTER] synonym.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900