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 8011899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:09:26+00:00 2026-06-04T19:09:26+00:00

I am transferring documents held in a SqlServer database to a RavenDB database. The

  • 0

I am transferring documents held in a SqlServer database to a RavenDB database. The process is simple but, in line with RavenDB’s ‘safety first’ principle, only the first 128 documents are actually stored.

I understand why this is the case and I also know this limit can be adjusted for the document store as a whole, however, given that storing more than 128 docs in a given operation is not too unusual, I would like to know what the best practice is?

Here is my code to show an example of how I get around the limit. Is there a more elegant way?

public static void CopyFromSqlServerToRaven(IDocumentSession db)
{
    var counter = 0;
    using (var connection = new SqlConnection(SqlConnectionString))
    {
        var command = new SqlCommand(SqlGetContentItems, connection);
        command.Connection.Open();
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                counter++;
                db.Store(new ContentItem
                            {
                                Id = reader["Id"].ToString(),
                                Title = reader["Name"].ToString(),
                                Description = reader["ShortDescription"].ToString()
                            });
                if (counter < 128) continue;
                db.SaveChanges();
                counter = 0;
            }
        }
        db.SaveChanges();
    }
}
  • 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-04T19:09:30+00:00Added an answer on June 4, 2026 at 7:09 pm

    You can store how much documents that you want in one operation. No need to save changes in chunks.

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

Sidebar

Related Questions

I am currently in the process of transferring to Fast CGI from the apache
I'm copying a database I include in my bundle with my app and transferring
I am transferring a database from one hosting provider to another. The current provider
I'm working on transferring data from one database to another. For this I have
I'm developing an application for transferring databases and directories of user-uploaded images/documents from our
Firebug shows not only the time it takes for individual requests, but splits them
This is my first time transferring my local dev site to another local site
We are currently transferring our websites from Windows 2003 (32-bit) to Windows 2008 (64-bit)
I have been transferring this script (http://jsfiddle.net/darkajax/FHZBy/) in to my live environment within a
Is it possible to automatically encrypt files via 'git push' before transferring to a

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.