CSV file to SQL in ASP.NEt via Schema.ini

Code with C | Programming: Projects & Source Codes Forums PHP CSV file to SQL in ASP.NEt via Schema.ini

This topic contains 4 replies, has 1 voice, and was last updated by  Amit 2 years, 1 month ago.

  • Author
    Posts
  • #11146

    Maxim6m0cj
    Member

    I need to download a csv file to sql to construct after a graph with visual studio.

    I have all of this running but with integration services, but i want to do the same without the integration services because integration services not exist in sql express.

  • #11147

    CWC
    Keymaster

    if you want to construct SQL statements from your CSV file, you can simply open it with a Spreadsheet program like Excel and insert the SQL statements between the data columns. A bit tedious, but it works Smile

    There might be tools to import CSV data if the columns match the tables in your database, but I’ve not familiar with any.

  • #11148

    Abhey
    Member

    I have a asp.net page with a graph with the values from sql, and the sql is construct with the csv, this csv refresh every second with new data.

  • #11149

    SapnaVishwas
    Member

    You could use awk on a Linux machine, or install one of the free versions available for Windows, and then run a script like this:

    using the command

    Of course this assumes that the CSV fields map one-to-one with your columns. If they don’t, you can use multiple awk scripts to extract the individual fields and generate multiple SQL scripts.

  • #11150

    Amit
    Member

    If you’re on windows look up using a Schema.ini to label the field names and type. Then all you have to do is something like SELECT * INTO tbl FROM [File Path] IN [Name of File] (I can’t remember the exact syntax now). You’ll end up with a table that has been imported nicely from a CSV.

    If you need more info PM me and i’ll reply when I’m at work – I’m doing this kind of thing there at the minute. It’s a very fast and easy way of getting the data into a table.

You must be logged in to reply to this topic.