Convert OPENQUERY to SQL

  • I am having a hard time and hoping someone could point out what I can't seem to figure out.

    We are migrating from an old environment to a new environment and our new environment is not allowed to use Linked Servers and as such, I need to convert an existing SQL Job that uses linked servers to an SSIS package.

    We have the following code as it exists:

    SELECT *

    INTO STG_M

    FROM OPENQUERY(OracleServer, 'SELECT NUMBER, ACCT_STATUS, CONTRACT_DATE FROM STG_M')

    In our SSIS Package, we have setup a connection to Oracle (simply called Oracle), and a connection to our SQL Server (simply called SQLServer). We want to pull in the data from Oracle and stored in our SQL Server. I am having a hard time converting the OPENQUERY into T-SQL Code that SSIS can run.

  • kocheese (6/1/2016)


    I am having a hard time and hoping someone could point out what I can't seem to figure out.

    We are migrating from an old environment to a new environment and our new environment is not allowed to use Linked Servers and as such, I need to convert an existing SQL Job that uses linked servers to an SSIS package.

    We have the following code as it exists:

    SELECT *

    INTO STG_M

    FROM OPENQUERY(OracleServer, 'SELECT NUMBER, ACCT_STATUS, CONTRACT_DATE FROM STG_M')

    In our SSIS Package, we have setup a connection to Oracle (simply called Oracle), and a connection to our SQL Server (simply called SQLServer). We want to pull in the data from Oracle and stored in our SQL Server. I am having a hard time converting the OPENQUERY into T-SQL Code that SSIS can run.

    Unsurprisingly, as Oracle does not use T-SQL. You need to use Oracle's version of SQL as your source query.

    Your query, however, looks like it should still run, given its simplicity.

    So ... can you provide more details about the hard time you are having? What errors are you getting?

    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.

  • kocheese (6/1/2016)


    I am having a hard time and hoping someone could point out what I can't seem to figure out.

    We are migrating from an old environment to a new environment and our new environment is not allowed to use Linked Servers and as such, I need to convert an existing SQL Job that uses linked servers to an SSIS package.

    We have the following code as it exists:

    SELECT *

    INTO STG_M

    FROM OPENQUERY(OracleServer, 'SELECT NUMBER, ACCT_STATUS, CONTRACT_DATE FROM STG_M')

    In our SSIS Package, we have setup a connection to Oracle (simply called Oracle), and a connection to our SQL Server (simply called SQLServer). We want to pull in the data from Oracle and stored in our SQL Server. I am having a hard time converting the OPENQUERY into T-SQL Code that SSIS can run.

    Heh... to what end are they making this requirement? Simplicity? I don't believe you'll find that to be true. 😉

    Save the old code. 😀

    --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)
    Intro to Tally Tables and Functions

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

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