Most efficient way of entering data into a SQL database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Most efficient way of entering data into a SQL database

    Sorry this isn't necissarily ASP, but it is VBScript & ADO and I figure that
    you all would be the best to ask.

    I am using a VBScript that reads a binary file and imports all that
    information into a database. The file is a proprietary financial database,
    and I am reading out names, accounts, and transactions into 3 2-dimensional
    arrays. Once the script is done, I want to import this data into 3 seperate
    tables (names, accounts, & transactions) in my database. I could import it
    using a For loop (like below) on each array and calling a separate SQL
    Insert command for each row that I will be inserting into the database, but
    I think that will be the most inefficient way of doing it.

    For i = 0 to Ubound(array1)
    oCmd.CommandText = "Insert Into..."
    oCmd.Execute
    Next

    My other idea was a Stored Procedure that I could pass a delimited string,
    parse the string in the SP and use a loop to Insert each row. I'm not sure
    how efficient that would be though. Or the other way, would be to export it
    all out to a csv and import it via DTS. Anyone have any ideas on what would
    be the best way to mass load this data. It will be run several times a day
    on several different binary files, so I really need it to be as efficient as
    possible.

    Thanks for any help,
    Matt


    Matt Guest

  2. Similar Questions and Discussions

    1. Most efficient data integration method
      Is there a support document somewhere that explains the different types of data integration (xml, cfc etc...) and which method is most effective? Is...
    2. Entering listbox values into database
      Let's say I'm using SESSION variables to create a form-based wizard (it has 12 steps, and therefore 12 pages to the wizard). Some of the values the...
    3. entering data into MS Access database
      Hello, I'm creating an online survey using XHTML -- no PHP -- where the data will be entering into a MS Access database, and I am having trouble...
    4. Entering Data and then having another linked data show up.
      I am creating a form. What I need help doing is setting up the following. First, I have a list box with about 12- 15 options to choose. Each of...
    5. Entering data on a form?
      On Mon, 30 Jun 2003 12:29:02 -0700, "grace" <grace.paltrineri@libertymutual.com> wrote: As much as I hate Smartquotes (what newsreader are you...
  3. #2

    Default Re: Most efficient way of entering data into a SQL database

    How about BULK INSERT? We use this for loading massive log files, and then
    we distribute the data with a query.

    For some of our processes, we have an external app that parses logs and
    builds CSV or TSV files that are friendlier for BULK INSERT (it discards
    some columns, and uses metadata to discard some rows, instead of BULK
    INSERTing extra crap for nothing).

    I can't imagine it would ever be practical to have an ASP page parse a
    file...

    --
    Aaron Bertrand
    SQL Server MVP





    "Matt" <MattnoChilders.spam_@msn.com> wrote in message
    news:uqwvgHCxDHA.2456@TK2MSFTNGP12.phx.gbl...
    > Sorry this isn't necissarily ASP, but it is VBScript & ADO and I figure
    that
    > you all would be the best to ask.
    >
    > I am using a VBScript that reads a binary file and imports all that
    > information into a database. The file is a proprietary financial
    database,
    > and I am reading out names, accounts, and transactions into 3
    2-dimensional
    > arrays. Once the script is done, I want to import this data into 3
    seperate
    > tables (names, accounts, & transactions) in my database. I could import
    it
    > using a For loop (like below) on each array and calling a separate SQL
    > Insert command for each row that I will be inserting into the database,
    but
    > I think that will be the most inefficient way of doing it.
    >
    > For i = 0 to Ubound(array1)
    > oCmd.CommandText = "Insert Into..."
    > oCmd.Execute
    > Next
    >
    > My other idea was a Stored Procedure that I could pass a delimited string,
    > parse the string in the SP and use a loop to Insert each row. I'm not
    sure
    > how efficient that would be though. Or the other way, would be to export
    it
    > all out to a csv and import it via DTS. Anyone have any ideas on what
    would
    > be the best way to mass load this data. It will be run several times a
    day
    > on several different binary files, so I really need it to be as efficient
    as
    > possible.
    >
    > Thanks for any help,
    > Matt
    >
    >

    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Most efficient way of entering data into a SQL database

    You say the database is proprietary, but you can access it from ASP/VBS so
    it can't be that bad. Does it output to CSV or Support ODBC?

    I had a similar issue when I needed to write web reports over a legacy
    FoxPro database... After mucking about trying to get the data imported,
    using linked servers and all sorts of things I ended by accessing the data
    from the FoxPro files SQL Stored Procedures and the OPENROWSET function. It
    is beautiful and allows you to join tables from disparate data sources all
    in to one nice result set which you can then pass back to ASP.


    "Matt" <MattnoChilders.spam_@msn.com> wrote in message
    news:uqwvgHCxDHA.2456@TK2MSFTNGP12.phx.gbl...
    > Sorry this isn't necissarily ASP, but it is VBScript & ADO and I figure
    that
    > you all would be the best to ask.
    >
    > I am using a VBScript that reads a binary file and imports all that
    > information into a database. The file is a proprietary financial
    database,
    > and I am reading out names, accounts, and transactions into 3
    2-dimensional
    > arrays. Once the script is done, I want to import this data into 3
    seperate
    > tables (names, accounts, & transactions) in my database. I could import
    it
    > using a For loop (like below) on each array and calling a separate SQL
    > Insert command for each row that I will be inserting into the database,
    but
    > I think that will be the most inefficient way of doing it.
    >
    > For i = 0 to Ubound(array1)
    > oCmd.CommandText = "Insert Into..."
    > oCmd.Execute
    > Next
    >
    > My other idea was a Stored Procedure that I could pass a delimited string,
    > parse the string in the SP and use a loop to Insert each row. I'm not
    sure
    > how efficient that would be though. Or the other way, would be to export
    it
    > all out to a csv and import it via DTS. Anyone have any ideas on what
    would
    > be the best way to mass load this data. It will be run several times a
    day
    > on several different binary files, so I really need it to be as efficient
    as
    > possible.
    >
    > Thanks for any help,
    > Matt
    >
    >

    David Morgan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139