Tab Delimited To MsSql

Posted on 2007-07-26
Last Modified: 2008-03-10
I have a tab delimited file that I need to  import into SQL via VB.  It will be generally 10-12 thousand records.  I have been reading about sqlbulkcopy but have not found any good code examples.  Can any suggest methods to import a large file like this efficiently as well as provide coding examples?
Question by:K3HT
    1 Comment
    LVL 96

    Accepted Solution

    Here is the SqlBulkCopy example:

    Imports System
    Imports System.Data
    Imports System.Data.SqlClient

    Public Class BulkInsert

      Public Shared Sub InsertDataTable(ByVal connectionString As String, ByVal table As DataTable)
        Dim copier As New SqlBulkCopy(connectionString)
        copier.DestinationTableName = table.TableName
      End Sub

    End Class


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    This video discusses moving either the default database or any database to a new volume.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now