Upload Bulk Data from csv to New or an Existing Table - Oledb .NET E05 - ID Card Make

Upload Bulk Data from csv to New or an Existing Table - Oledb .NET E05 - ID Card Make In this episode I'll demonstrate how to upload bulk data from CSV file into database um let me quickly show you the sample first so this is um CSV file with about 20 MB of data uh three columns of.

Upload Bulk Data from csv to New or an Existing Table - Oledb .NET E05

Data with I think this will be about a million records um so first we'll import this into a new table and then I'll also demonstrate how to import it to a.

Existing table okay I'm going to close this without saving um close this as well uh so let's call this a.

Bu let's call this upload bug data I'm going to copy all this um this part will rewrite this part the rest will be the.

Same okay so here um first we'll do uh select select into um that will create a new table so select uh all into and then um here we specify from where we are.

Getting the data so from and then here we will put in our uh CSV um connection string so it will be a text and then um format will be delimited um and then header so if you.

Have a header then you specify yes um so we have a header so if you don't have a header you set set this to sorry this will be header if you set this to no then it will create a field.

Like uh field one two and three and so on okay uh so we'll specify yes for our uh connector and then next you can specify the database path.

Um not the full uh file but just the path okay so here we'll say um database and then is equal to and then this will be the part and Dot you specify the file name so the.

File name is this Dot and then within the brackets you put this so we're saying select into and then here we'll specify the table uh let's call this.

New transaction transaction table something like that uh select all into this table and then the format is uh this will be.

Text um eled just crosschecking this im here database and then this is going to be the part and the file name okay so let's try and run.

    This we can add a new button - ID Card Make

    Here and let me just call this .

    Uh okay let's try this okay so that's I think was quick that was very quick if you look at the records 93,000 records this uploaded in like within a second.

    Okay so if you go here you'll see data type was already automatically created okay so that's uh if you have to import into a new table by creating the table.

    Automatically uh I'm just going to make a copy of this table just a structure copy paste and let me call this as a transactions.

    Okay let's say that we want to import into existing table so this will be sortex customer ID and this will be date and this will be a number and we want this to be double so.

    That you can hold decimal points okay so um let's create a second part of SQL.

    Going to copy this and now instead of um select into we'll use insert into okay uh so insert into and then you'll specify the table you want to insert.

    Into let me just close this first insert into this table and then you can specify the fields so what are the fields.

    Here customer ID comma transaction date and amount close this and then uh from The Source we want to select.

    I'm sorry not

    here just use the same Fields because these are the field names that are there in.

    CSV uh select this from and then uh this will remain the same let's try again.

    Look like there is some problem it didn't return any error though let me open this in debx so that if there's any error we can see it okay so it says syntax error near insert.

    Into okay I think this is a problem I didn't recheck that my bad so insert into the table Fields select this fields from this table again now I'm going to open up in the r.

    Time okay so let's see I'm going to refes F5 okay so all the data has been imported successfully ner records into existing table and that will be it for this video.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=-H4sAcZlVR8
Previous Post Next Post