Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Synonym Help


Synonym Help

Author
Message
mcopa
mcopa
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 132
I have a linked server called DOA_FANS on my SQL 2012 that connects to an Oracle server/database. One of the tables in Oracle is called FIS.TITLE.CONTRACTS I can use this and read the table: SELECT * FROM OPENQUERY(DOA_FANS,'Select * from FIS.TITLE_CONTRACTS'). I was asked to create a synonym called FTC so that the query could be shorter. I executed this command:
CREATE SYNONYM FTC
FOR DOA_FANS.FIS.TITLE_CONTRACTS
GO
and it said it executed successfully. However, when I try SELECT * FROM FTC I get a error msg 5313 that says Synonym 'FTC' refers to an invalid object.
I checked sys.synonyms and it is there. I have seen several posts online that this should work, but it isn't.
mcopa
mcopa
SSC Rookie
SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)SSC Rookie (30 reputation)

Group: General Forum Members
Points: 30 Visits: 132
I figured it out. When creating the synonym I needed two dots after linked server name:
CREATE SYNONYM FISVEND
FOR DOA_FANS..FIS.VENDORS_V
GO

However...running the query from openquery took 39 seconds to return 215,848 rows BUT running the query with synonym took 2 min 52 seconds. Any ideas why?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search