{"id":11,"date":"2007-11-22T00:56:26","date_gmt":"2007-11-22T00:56:26","guid":{"rendered":"http:\/\/muratyaman.co.uk\/wp\/?p=11"},"modified":"2020-04-01T13:06:02","modified_gmt":"2020-04-01T12:06:02","slug":"m-sql-server-using-remote-servers-linked-servers","status":"publish","type":"post","link":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/2007\/11\/m-sql-server-using-remote-servers-linked-servers\/","title":{"rendered":"MS SQL Server: Using Remote Servers (Linked Servers)"},"content":{"rendered":"<p>Sometimes I need to have a quick way of transferring data from one database to another running on a separate machine, especially when the table structures are identical or similar, it saves time. M$ SQL Server 2005 has a feature called <b>linked servers<\/b>.<\/p>\n<p><img src='http:\/\/muratyaman.co.uk\/wp\/wp-content\/uploads\/2007\/11\/linked_server2.jpg' alt='New Linked Server' \/><\/p>\n<ol>\n<li>Give a <b>name<\/b> to your server: SERVER123<\/li>\n<li>Choose a <b>provider<\/b> depending on the type of server you want to connect; the safest and the easiest may be ODBC so that you can link many different types of servers.<\/li>\n<li><b>Data source<\/b> can be something like this:<br \/>\nDriver={SQL Server};Server=myServ;Database=myDB;Uid=myUsr;Pwd=myPass;<\/li>\n<li>Check the security details and other options as well.<\/li>\n<\/ol>\n<p>If you want to use an ODBC connection, define it first using Data Sources inside control panel of Windows.<\/p>\n<p>Then, you can run a script using SQL Management Studio or your favourite database management tool such as this:<\/p>\n<p><code>INSERT INTO TableA (column1, column2, ...)<br \/>\nSELECT columnA, columnB, ...<br \/>\nFROM SERVER123.SOMEDB.dbo.TableB<\/code><\/p>\n<p>(<b>dbo<\/b> is for the schema name)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes I need to have a quick way of transferring data from one database to another running on a separate machine, especially when the table structures are identical or similar, it saves time. M$ SQL Server 2005 has a feature called linked servers.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[198,56,33],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-technology","tag-integration","tag-ms-sql-server","tag-sql"],"_links":{"self":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":2,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}