« Acquire SQL Service AccountMaintenance Plan history »

Linked Server....

Permalink 07/25/11 10:14, by admin, Categories: Projects, SQL Server, 2008, 2005

Well today, I started the fun filled adventure of managing data from/to a LinkedServer.

During this learning curve, I found plenty of information about how to query from and instert into a Linked server but most of them utilized the OpenQuery TSQL Statement to operate.

One failure of the concepts is to use the inline statement to access the Linked Server.

In my situation, i was linking to a MySQL database offsite. Below you will find the MSSQL statement patterns to used when utilizing query statements against the Linked Server.

Select:

Select {cols}
From {LinkedServer}...{table}
[Conditions]

Insert:

Insert Into {LinkedServer}...{table} [cols,...]
Values ([cols,...])

There are more commands you can use but the point is that the developer/dba is utilizing only the 'server' and 'table' portions of the source information. This being, as described by Microsoft, as '{server}.{database}.{schema}.{table}' is simply '{linkedserver}...{table}'. At least for MySQL, they do not broadcast schema information through general access this is mostly handled by the login credentials instead, as i understand the framework.

In summary, instead of building god-aweful string concatenations with double/triple/etc single quotes to try and get the Execute style expression to execute against the remote server, just use the dot system already in place. Will allow you to operate on the database/tables in the same way as you maybe/are comfortable with.

AdSense

Programming Blog about the different projects we are working on.

Search

May 2012
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

XML Feeds

blog soft