-
Oct 31st, 2014, 04:10 PM
#1
Thread Starter
Hyperactive Member
Read CSV file and then upload into SQL server
I have to create a project to upload big csv file (3.5G, about 300 columns) into SQL server.
This csv file FIELDTERMINATOR =',' , text qualifier="" and first row is column name.
Questions:
1) Do I need to create table first in order to insert csv data file into it?
2) Is it possibel to upload into SQL server based on CSV data structure, that is, don't need to create a table first?
Help!
-
Oct 31st, 2014, 07:44 PM
#2
Member
Re: Read CSV file and then upload into SQL server
Hi aspFun,
I am pretty new to visual basic.net, but from what I have seen and read and what I have being testing with myself, Yes, create the table in SQL Server first.
I would try a handful of rows first just to make sure you have the structure correct and field length correct as well.
Or
You could use the import function within SQL Server to create your table for you rather than do it manually, then create your project to import your data
Others may come along with a different view, but this is how I have been doing it.
Just my approach!!
=====================
James Niven
Austin, Texas
=====================
-
Oct 31st, 2014, 07:57 PM
#3
Re: Read CSV file and then upload into SQL server
You need to create the table in order to insert data into it, but you can create the table at the time you read the data. While not unheard of, it would be fairly unusual to import data for which you didn't know the schema ahead of time though.
-
Nov 1st, 2014, 08:31 AM
#4
Re: Read CSV file and then upload into SQL server
I don't use msSQL but in mySQL you would have 2 options to import a CSV into the database; either the mysqlimport utility or using the LOAD DATA INFILE query and I would be very surprised if msSQL did not have the same functionality in some form. Either way, both of those options are outside the scope of VB.net, so if they look like what you want, you should post in the Database Forum
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|