Difference between OPENROWSET & OPENDATASOURCE

  • Hi Friends,

    What is difference between OPENROWSET & OPENDATASOURCE.

    To use OPENROWSET & OPENDATASOURCE, what parameters should enable.

    Give an example for OPENROWSET & OPENDATASOURCE using query.

    How to transfer bulk data to different table in a database from external file using query.

  • Are these interview questions, homework questions, or test questions?

    --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)

  • Click here

  • nigel. (10/7/2009)


    Click here

    LoL 🙂 :hehe::-D

    -Forum Etiquette: How to post Performance Problems[/url]

    -Forum Etiquette: How to post data/code to get the best help [/url]

  • nigel. (10/7/2009)


    Click here

    Heh... I always get a kick out of lmgtfy.com. It's more fun than "Please visit BOL."

    --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)

  • What an answer!!!!!!!!!!!!!!

    Fabulous!!

    Manu

  • Like your response Nigel. What a way to tell the person to initiate and try to learn yourself. 😛

  • Don't think I was too harsh do you? I know he's only a newbie but there is a limit!!

    Obviously homework or something,as Jeff alluded to earlier. His question clearly shows he hasn't even tried.

  • What about this?

    Please click here for help.

    I might add this to the links in my sig just for these sort of occassions. 🙂

  • nigel. (10/7/2009)


    Click here

    😀

    "Keep Trying"

  • I don't think that you are being too harsh. 🙂

    Some people want to learn how to do things themselves and just need to be pointed in the right direction. The rest think they are too busy (or too important) to dig in and understand a subject and expect someone to do it for them.

    Goes with the old saying "Give a man a fish and you have fed him for today. Teach a man HOW to fish and he can feed himself for the rest of his life."

    BTW, I have never seen TMGTFY.com before. This is GREAT! :w00t: I will use this for a lot of things in the future!

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers

  • RandMan-585256 (10/8/2009)


    I don't think that you are being too harsh. 🙂

    Some people want to learn how to do things themselves and just need to be pointed in the right direction. The rest think they are too busy (or too important) to dig in and understand a subject and expect someone to do it for them.

    Goes with the old saying "Give a man a fish and you have fed him for today. Teach a man HOW to fish and he can feed himself for the rest of his life."

    BTW, I have never seen TMGTFY.com before. This is GREAT! :w00t: I will use this for a lot of things in the future!

    Cheers RandMan,

    By the way it's lmgtfy.com (a slip of your fingers I guess). I found someone else quoting it in this forum some time back.

  • Yeah - fat fingers . . . . . . you ought to see me code!:w00t:

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers

  • To sum up, openrowset() allows you to create an ad-hoc connection to oledb

    provider and execute a query.

    e.g.

    select * from openrowset('conn','query')

    Opendatasource() also allows you to create an ad-hoc connection but it allows

    you to reference the provider in a 4-part-name.

    e.g.

    select * from opendatasource('conn').db.owner.obj

  • jmichaud (10/8/2009)


    To sum up, openrowset() allows you to create an ad-hoc connection to oledb

    provider and execute a query.

    e.g.

    select * from openrowset('conn','query')

    Opendatasource() also allows you to create an ad-hoc connection but it allows

    you to reference the provider in a 4-part-name.

    e.g.

    select * from opendatasource('conn').db.owner.obj

    But you can also reference a provider object using OpenRowSet...

    SELECT a.*

    FROM OPENROWSET('SQLNCLI', 'Server=Seattle1;Trusted_Connection=yes;',

    'SELECT GroupName, Name, DepartmentID

    FROM AdventureWorks.HumanResources.Department

    ORDER BY GroupName, Name') AS a;

    no?

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

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