Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9190133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:23:31+00:00 2026-06-17T20:23:31+00:00

how to write query in OLE DB Command or oledb destination (data access mode

  • 0

how to write query in OLE DB Command or oledb destination (data access mode – sql command) to insert data to partition view from table/view.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:23:32+00:00Added an answer on June 17, 2026 at 8:23 pm

    A Partitioned View is something I had no experience with prior to this question. Using the definition provided in the linked article, I came up with this schema and a sample insert to verify I knew I was doing.

    I rolled the transaction back so I had no data in my dbo.Year1998Sales view. I then created a new SSIS package. The fact that I used SSIS for SQL Server 2012 will have no bearing on the results, the configuration will be the same.

    I created a new package, added a data flow, added an OLE DB Connection Manager and within my Data Flow I have an OLE DB Source wired to an OLE DB Destination.

    enter image description here

    In my source, I used the same query as in my SQLFiddle demo

    SELECT 
        D.number AS OrderId
    ,   D.number * 100 AS CustomerID
    ,   DATEADD(D, d.number % 365, '1998-01-01') AS OrderDate
    ,   1+ (D.number % 12) AS OrderMonth
    ,   DATEADD(mm, (D.number % 12), '1998-01-01') AS DeliveryDate
    FROM
    (
        SELECT
            ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) -1 AS some_number  
        FROM
            master.dbo.spt_values AS SV  
    ) D (number)
    ORDER BY D.number ASC;
    

    I selected dbo.Year1998Sales as the destination and viola, it works. Actually no, it didn’t to my amazement. What worked within SSMS errors out in a data flow.

    [OLE DB Destination 2] Error: SSIS Error Code DTS_E_OLEDBERROR. An
    OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is
    available. Source: “Microsoft SQL Server Native Client 11.0”
    Hresult: 0x80004005 Description: “Partitioned view
    ‘FOO.dbo.Year1998Sales’ is not updatable as the target of a bulk
    operation.”.

    Resolution

    The telling portion of this error message is the “target of a bulk operation.”
    A Data access mode of Table or view - fast load or Table name or view name variable - fast load will result in a bulk insert into the table and generally speaking that is something you will want. However in this case, that isn’t possible so one must use the RBAR (row by agonizing row) version of a destination Table or view or Table name or view name variable.

    That does work and for smaller data sets, that would be my approach.

    Alternative 1

    Completely bypass the logical construct of the view and recreate the logic with a conditional split and write to N tables. This would allow you to use bulk updates to the table. However, there’s a not insignificant cost associated with replicating that business logic into your package and further maintenance on the package to keep the two in sync. Heaven help you if the logic gets changed in the underlying view and those changes aren’t propagated to the package or ported incorrectly. I would not go this route unless I had a bullet-proof business reason for doing so.

    Alternative 2

    Stage your data. Instead of writing to the partitioned view, write all the data to a staging table in the data flow. Immediately after the data flow, have an Execute SQL Task that pushes the data from the staging table into the View.

    While I don’t know for certain, my assumption is that this will perform better than Alternative 1 or the original resolution but have not tested. I also don’t list this as the primary resolution because I know in some places, like where I work, creating a new table can be rather controversial.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a query to insert data from .lst file into table name AxisATM
I wanted to write a query to delete from x table and y table
I have column to in table, when I write query SELECT to FROM mytable
I'm using Grid view in my asp.net page and I'm fetching data from SQL
I have table(data) having category(0=picture,1=video,2=music) views(numbers of views) I want to write query that
how to write query for following request? my table: id designation 1 developer,tester,projectlead 1
I need to write q query where I check if the table exists, and
How can I write a query similar to this one in LINQ to SQL
Im trying to write query in linq Select UserId, UserNumber FROM User where UserNumber
I'm trying to write a HQL/Criteria/Native SQL query that will return all Employees that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.