Link Server

  • Hello guys, I need of you help.

    I have 3 SQL server, srv1, srv2 and srv3.

    srv2 have 2 network cardtopologia

    I hope you can help me.

    Thanks .

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Use synonyms, views on srv 2 ? Srv3 queries srv2 (which queries srv1)

  • Hello Jo

    srv2 is an intermediary to send data a srv1 (main server)

    srv3 is a Tester with database, and I want to send since srv3 to srv1

    Insert into svr1.DB.dbo.table

    Select fields from srv3.DB.dbo.table WHERE sent='N'

    But I dont see srv1 since srv3

  • Hello Jo

    I make this:

    Link svr1 to svr2, then link srv3 to svr2.

    In srv2 a stored procedure was made to send to svr1.

    in srv3 a stored procedure was made to get values and execute the stored procedure in srv2 passing values

    I still don't try, but tomorrow I will.

  • My question would be.... why do you NEED to go through the intermediate server to begin with?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hello Jeff

    For security policies. which this as srv3 is a computer with windows xp and sql server express and cannot be connected to the main network.

  • mariomoyeda wrote:

    Hello Jeff

    For security policies. which this as srv3 is a computer with windows xp and sql server express and cannot be connected to the main network.

    What sort of security policy allows you to have a 'server' running Windows XP?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Can you use SSIS?  If not Jo Pattyn's option is the better one.  If you're comfortable with SSIS here’s how I/we used to do something similar as part of an ETL solution until we moved systems.

    From srv2 create a linked server to Srv3

    In an SSIS project / solution have two connections Source “master” database on srv2, and destination <yourdatabase> on Srv1

    Create a package, as a “Data Flow Task” with an OLE DB Source with a Data access mode of “SQL command” which runs your query from the data on Srv3 in the following format;

     

    SELECT column1, column2…columnX

    FROM <linkedServernameofSrv3on Srv2>.<DatabaseSRv3>.<Schema>.<table or view>

    Note 1 – the <linkedServernameofSrv3on Srv2> is the name you created earlier in an earlier step.

    Note  2– if the source is complex a View might be a better option than a complex query in

     

    Add an OLEDB destination connected to srv1 to the destination table.  Run the package or deploy it to SSISDB.

     

    My/our solution did a couple of other things such as truncate the target table before copying data across.  We then processed the data further downstream as part of our ETL.

  • Phil,

    The srv3 is a tester machine (plc and other devices)  for this reason exists other local network.

  • rob.kaye wrote:

    Can you use SSIS?  If not Jo Pattyn's option is the better one.  If you're comfortable with SSIS here’s how I/we used to do something similar as part of an ETL solution until we moved systems.

    From srv2 create a linked server to Srv3

    In an SSIS project / solution have two connections Source “master” database on srv2, and destination <yourdatabase> on Srv1

    Create a package, as a “Data Flow Task” with an OLE DB Source with a Data access mode of “SQL command” which runs your query from the data on Srv3 in the following format;

    SELECT column1, column2…columnX

    FROM <linkedServernameofSrv3on Srv2>.<DatabaseSRv3>.<Schema>.<table or view>

    Note 1 – the <linkedServernameofSrv3on Srv2> is the name you created earlier in an earlier step.

    Note  2– if the source is complex a View might be a better option than a complex query in

    Add an OLEDB destination connected to srv1 to the destination table.  Run the package or deploy it to SSISDB.

    My/our solution did a couple of other things such as truncate the target table before copying data across.  We then processed the data further downstream as part of our ETL.

    Rob,

    I am going to try.......

  • mariomoyeda wrote:

    Phil,

    The srv3 is a tester machine (plc and other devices)  for this reason exists other local network.

    You used the terms security and XP in the same sentence, and that's what triggered my response.

    Support for XP ended in 2014. It cannot be considered secure.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Hello All,

    thank you all for your contributions.

    The problem was resolved.

  • Excellent news!  Glad it's resolved.

  • mariomoyeda wrote:

    Hello All,

    thank you all for your contributions.

    The problem was resolved.

    Two way street here... 😉  Please tell us what you did to resolve the problem.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply