Group29.com - What did you expect?
  Create an account
:: Home  ::  Downloads  ::  Your Account  ::  Forums  ::
Google Adsense
Modules
  • Home
  • Downloads
  • ExpectationReviews
  • Forums
  • Group29 FAQ
  • MovieReviews
  • OtherReviews
  • Stories Archive
  • Submit News
  • Top 10
  • Topics
  • Web Links
  • New at Group29
    ·Movie Review: Star Wars: The Last Jedi [23]
    ·2017 USC vs UCLA preview
    ·Movie Review: IT (2017) [25]
    ·Forum Topic: Update your Facebook property
    ·2016 UCLA vs USC preview
    ·Expectation Review: Star Wars: The Force Awakens [29]
    ·Web Link: WEP Key Converter
    ·Expectation Review: Jupiter Ascending [25]
    ·Forum Topic: Why does my IPA file get saved as a zip file in IE?
    ·Web Link: BeyondCompare

    read more...
    TheForce.Net
    ·Rebelscum Breast Cancer Awareness Charity Patch
    ·BBC Interviews J.J. Abrams About Trek And Wars
    ·CEII: Jabba's Palace Reunion - Massive Guest Announcements
    ·Fathead's May the Fourth Be With You!
    ·Star Wars Night With The Tampa Bay Storm Reminder
    ·Stephen Hayford Star Wars Weekends Exclusive Art
    ·ForceCast #251: To Spoil or Not to Spoil
    ·New Timothy Zahn Audio Books Coming
    ·SDCC: Exclusive Black Series Boba Fett With Han In Carbonite Set
    ·Star Wars Art Exposition May 4th

    read more...
    Hot trends
    ·Group29.com

    read more...
    Group29 Discussion Board :: View topic - Compare tables on Different Microsoft SQL servers
    Log in Register Forum FAQ Memberlist Search
    Ratings, Links, Free Speech and more

    Group29 Discussion Board Forum Index -> Group29 Tech Tips -> Compare tables on Different Microsoft SQL servers
    Post new topic  Reply to topic View previous topic :: View next topic 
    Compare tables on Different Microsoft SQL servers
    PostPosted: Tue Dec 28, 2004 10:49 am Reply with quote
    BB
    Regular
     
    Joined: Jun 23, 2004
    Posts: 340


      


    Subject: Compare tables on Different SQL servers

    The servers must be linked (See SQL Books Online, Security --> Linked Servers) through Enterprise Manager or a stored procedure

    This example compares a table called "table1yr" in the sampledb on two different servers SQL06 and SQL03.

    Code:
    SELECT DISTINCT * FROM SQL06.sampledb.dbo.table1yr
      WHERE ITEMID in
      (
        select DISTINCT ItemID from SQL06.sampledb.dbo.table1yr
          WHERE ITEMID NOT IN
          (
            SELECT ITEMID FROM SQL03.sampledb.dbo.table1yr
          )
      )
    View user's profile Visit poster's website
    JOIN SQL server tables from different servers
    PostPosted: Tue Dec 28, 2004 10:53 am Reply with quote
    BB
    Regular
     
    Joined: Jun 23, 2004
    Posts: 340


      


    Subject: JOIN SQL server tables from different servers

    How to join tables from different servers?

    To be able to join tables between two SQL Servers, first you have to link them. After the linked servers are setup, you just have to prefix your tables names with server name, database name, table owner name in your SELECT queries. The following example links SERVER_01 to SERVER_02. Execute the following commands in SERVER_02:

    Code:
    EXEC sp_addlinkedserver SERVER_01
    GO


    Link a login between two servers. (This is an example! You should not link the sa user! Also, the sa password should not be 'sa'!)

    Code:
    /* The following command links 'sa' login on SERVER_02 with the 'sa' login of SERVER_01 */
    EXEC sp_addlinkedsrvlogin @rmtsrvname = 'SERVER_01', @useself = 'false', @locallogin = 'sa', @rmtuser = 'sa', @rmtpassword = 'sa password of SERVER_01'
    GO


    Here is a sample query:

    Code:
    SELECT a.title_id
    FROM SERVER_01.pubs.dbo.titles a
    INNER JOIN SERVER_02.pubs.dbo.titles b
    ON a.title_id = b.title_id
    GO
    View user's profile Visit poster's website
    Compare tables on Different Microsoft SQL servers
      Group29 Discussion Board Forum Index -> Group29 Tech Tips
    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot vote in polls in this forum
    All times are GMT - 6 Hours  
    Page 1 of 1  

      
      
     Post new topic  Reply to topic  


    Powered by phpBB © 2001-2003 phpBB Group
    Theme created by Vjacheslav Trushkin
    Forums ©
    Group29 Productions

    All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.


    You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php


    PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
    Page Generation: 0.18 Seconds

    :: HeliusGray phpbb2 style by CyberAlien :: PHP-Nuke theme by www.nukemods.com ::