September 16, 2024 at 12:38 pm
not sure what you are asking Jeff. I'm going on the word of someone here who said he tried it and got an error that specifically forbids syns on linked servers. I'll try it for myself , to verify what he says and post back here. There is an old saying "no good deed goes unpunished".
September 16, 2024 at 4:57 pm
i thought i responded to this already. jeff i dont get what you are saying but a peer claims a synonym for the linked server name itself is forbidden. i'll have to verify and post back here.
September 16, 2024 at 5:54 pm
you don't create a synonym for the linked sever name - you create a synonym for a object that resides on a linked server.
this means that your code would reference a synonym on current db (for example) pointing to linkedserver.database.schema.remoteobject - and if you change any of the 4 parts of the referenced object you just need to recreate the synonym without chaning any code.
September 17, 2024 at 4:36 am
i thought i responded to this already. jeff i dont get what you are saying but a peer claims a synonym for the linked server name itself is forbidden. i'll have to verify and post back here.
My apologies that I wasn't clear on this. Synonyms need to point at an object, so you need the 4 part naming for the objects that the linked server can see... just like Frederico said in the post above.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 17, 2024 at 12:30 pm
thx frederico. we understand.
September 17, 2024 at 12:41 pm
thx jeff. i believe what we used to solve this went as follows. i was talking our dba thru this because he has permissions where we wanted it done. i believe i saw it working then when my other peer ran his query, the one that he was hoping he wouldnt need to change in his app.
September 17, 2024 at 7:58 pm
my other peer ran the query select * from db1.dbo.view1. which worked and is the query he doesnt want to change in his app. we arent gurus but in our minds by naming the linked server this way, "db1" represents the server1.db1 part of a query against server1.db1.dbo.view1. and its all done without any synonyms anywhere.
I seriously doubt this actually worked as you think it worked - since SQL Server has no way of 'translating' the database reference in 3-part names to the 4-part server name.
In other words - SELECT * FROM db1.dbo.View1 - cannot access anything other than a database named db1, a schema named dbo - and an object named View1. I suspect that you still have a database named db1 - and in that database there is a view with the name dbo.View1.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 7 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply