July 23, 2010 at 18:29
filed under Dynamics AX
Tagged Database, Dynamics AX, Linked server, SQL
Hi all, hope you are well.
Some time ago, I talked about executing direct sql statements, and now I want to share some sql statements that I used to manage linked server connections.
What follows are 4 sql statements that allow you to add en remove linked servers on a database at runtime.
Some assumptions:
– There is a str variable named “query” that will contain the query
– there is a parm method on the class that return the sql server (“server” or “server\instance”)
– there is a parm method that returns a username
– there is a parm method that returns a password
Check if linked server exist
First check if the linked server doesn’t exist yet, or you will get an error when you try to add one that already exists.
Add linked server
When the linked server doesn’t exist, add it.
Add linked server login
Optionally, you can add a login that will be used to connect to the linked server.
Remove linked server
Optionally, you can remove the linked server.
no comments
RSS / trackback