Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SQL server linked servers help

  • 14-01-2014 11:19pm
    #1
    Registered Users, Registered Users 2 Posts: 1,510 ✭✭✭


    I have an exam tomorrow and have a sample question I can't answer.
    Can someone help please :(

    Its stating there is a linked server in Australia called melbourne' which is linked to a local one called Sligo. Which code would be best to get a query to execute on it.

    SELECT *
    FROM OPENROWSET ([MELBOURNE])
    , 'SELECT * FROM
    product_tbl

    OR

    SELECT *
    FROM OPENQUERY ([MELBOURNE])
    , 'SELECT * FROM
    product_tbl

    OR

    ' SELECT * FROM product_tbl')
    In (OPENQUERY([MELBOURNE])


    Any help would be greatly appreciated thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 1,920 ✭✭✭GavMan


    Think your 2nd query is closest of the 3.

    Its been a while but I think it should be something like:

    SELECT * FROM OPENQUERY (MELBOURNE, 'SELECT * FROM product_tbl')


  • Closed Accounts Posts: 5,361 ✭✭✭Boskowski


    Neither of the three.

    OpenRowSet , OpenDataSource and the like are for situations where no linked server setup exists.
    Typically these statements include all the credentials to query the database, like servername, username, password etc.

    When querying a linked server you simply use the fully qualified name, for example:

    select * from [melbourne].[mydatabase].[dbo].[product_tbl]

    On top of the linked server setup you need to make sure your database user & password are lined up too.

    Of course this is too late for your exam and you probably know the answer by now, but wanted to post for everyones benefit anyway.


Advertisement