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

  • SEARCH
  • Home
  • 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 7086793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:35:39+00:00 2026-05-28T07:35:39+00:00

I want to transfer a large amount of data from F# to an SQL

  • 0

I want to transfer a large amount of data from F# to an SQL table. Basically my F# code creates a matrix of three columns (UserID, ProductID and price) and N lines. I would like to “copy/pate it” into a database
I tried several options but at the end, the transfer of data from F# is really slow (around one hour for 10000 lines).

Thanks to answers of a previous question How to include a stored procedure in F#, an interesting way to resolve this problem is to use SqlBulkCopy.

SqlBulkCopy requires a database type for its WritetoServer method but I didn’t find any existing code or simple way to convert a matrix into a database.
Do you have any suggestions or ideas?

  • 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-05-28T07:35:39+00:00Added an answer on May 28, 2026 at 7:35 am

    This should get you started (and reference the documentation for more information about SqlBulkCopy):

    //you must reference System.Data and System.Xml
    open System.Data
    open System.Data.SqlClient
    
    let bulkLoadUserPurchases (conn:SqlConnection) (userPurchases: list<int * int * float>) =
        use sbc = new SqlBulkCopy(conn, SqlBulkCopyOptions.TableLock, null, BatchSize=500, BulkCopyTimeout=1200, DestinationTableName="YOUR_TABLE_NAME_HERE")
        sbc.WriteToServer(
            let dt = new DataTable()
            ["UserID", typeof<int>
             "ProductID", typeof<int>
             "Price", typeof<float>]
            |> List.iter (dt.Columns.Add>>ignore)
    
            for userPurchase in userPurchases do
                let userId, productId, price = userPurchase
                let dr = dt.NewRow()
                dr.["UserID"] <- userId
                dr.["ProductID"] <- productId
                dr.["Price"] <- price
                dt.Rows.Add(dr)
    
            dt)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to transfer the data from one table in sql to another is
I want to transfer all data from one table into another with the following
I want to transfer data(21M rows) from mysql database to DynamoDB. I am using
I have a large amount of bugs from Jira and Github that I want
I want to transfer data from a vertical db layout like this: --------------------- |
I want to transfer data that appears in Arduino to my C# application and
I just want to transfer (send or receive) a hash from client to server.
In my java application I want to transfer some Images from client to server.
It is crucial that I transfer the least amount of data possible between server
In my WCF service, when trying transfer large data I constantly get an error:

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.