How to use openrowset query

  • Hi all,,

    I want to know how can i use openrowset to select data from another server...

    I gave like this:-

    select * from

    OPENROWSET( 'server_name',

    'Trusted_Connection=yes;Data Source=clairehsu;Initial Catalog=MSSQLTIPS',

    'select * from MSSQLTIPS.dbo.dept' )

    It gave me an error::

    Msg 7403, Level 16, State 1, Line 1

    The OLE DB provider "'server_name'" has not been registered.

    Any help..

    i dont have the rite syntax...

    Thanks

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

  • You posted this in the SSIS forum, are you trying to do this in SSIS? If so, is this in a ExecuteSQL task or where have you done this?

    Selecting data from another server is very easy in SSIS, I would recommend setting up a connection in the connection manager and using that to get your data into SSIS, not openrowset.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • ya john your are Absolutely right,

    if you dont use ssis

    it is better to use linked server concept to retrieve data from another server

    step1: add linked server

    step2: add linker server login

    to query:select * from [servername] .[databasename].[tablename]

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

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