THE CSV PROBLEM

  • Hello everyone,

    First of all, thank you very much for this great community.

    I hope you can help me.

    I have been struggling for days with importing CSV files. The background is that I am currently doing an SQL course and would like to work with the CSV files provided.

    I have already tried all possible variants that I can find on the Internet. I have also switched to MySQL and DBeaver and tried it there. Without success.

    I'm not sure whether I just lack basic knowledge or whether it is generally difficult to import CSV into SQL. How do you do it with data sets in CSV format that are too big for Excel?

    I would like to view and analyze many data sets in CSV format later, so I need a solution for this problem. Or is this data format not recommended anyway?

    I am uploading an example file here. The import actually worked, but there were always problems with the data type in the last column (Value). I think this was probably also due to the 1000 separators.

    I have read countless instructions for importing files on the Internet. Nothing worked.

    I hope you can give me a few tips on how to deal with this.

    Many thanks and best regards

    Attachments:
    You must be logged in to view attached files.
  • I just tried this and it imported quite easily.

    Assuming you're in SQL Server Management Studio and want to import the data into a new table in a database which already exists, here is what I did:

    • Right click the database in Object Explorer and select Tasks/Import Flat File
    • Browse to the location of your file and enter a table name. You should see your data in a preview window.
    • On the Modify Columns page, set Value to Allow Nulls
    • Go ahead and import.

    I received the following warning – I have not analysed the data to find out which bits have been dropped.

    Value

    Job done.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • These are the rows that did not import properly:

    Value2

    and here are the originals (taken from the CSV file)

    Value3

    So now you can see why they were set to NULL during the import … they are not numeric.

    • This reply was modified 2 months, 2 weeks ago by  Phil Parkin.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply