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

  1. #1

    Default Read CSV to SQL

    Does anyone have an example of how to read a .csv file into a SQL
    database with an ASP?
    Dave Karmens Guest

  2. Similar Questions and Discussions

    1. Everyone Please Read This
      Hi Everyone, I'm sending a letter to Adobe to request some improvements to the forums. I have given a bit of info in my 'Message for regulars'...
    2. read xml
      hello how can i read only the value's of this xml into asp.net (vbs) ? I want the variables name and address Example: name = "Myname" <scorelist>...
    3. File system get auto change from read-write to read-oly
      I have a very strange file system with OS Redhat 7.2 The file system is read-write, but some how it randomly changes to read-only at any time....
    4. Read & Read/Write Groups
      I am trying to achieve a solution to a (hopefully) simple scenario. I have a Solaris 9 server that is going to be used for sharing files. I...
  3. #2

    Default Re: Read CSV to SQL

    Dave Karmens wrote:
    > Does anyone have an example of how to read a .csv file into a SQL
    > database with an ASP?
    You would be better off using DTS to do this (bcp if you have a 6.5 server).
    Alternatively, with SQL 7 and above, there is a T-SQL command called "Bulk
    Insert" which can be called from asp just as any other query would be
    called. You should be able to find a lot of information about this command
    in SQL Books Online (BOL).

    I'm aware that a Google search will yield examples of using ADO or FSO to
    open a text file and loop through its contents writing the data to a
    database, but those solutions are not likely to perform as well as DTS or
    Bulk Insert.

    Bob Barrows



    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: Read CSV to SQL

    Aaaaah... ok, I'll take a look around. Thanks Bob!

    Bob Barrows wrote:
    > Dave Karmens wrote:
    >
    >>Does anyone have an example of how to read a .csv file into a SQL
    >>database with an ASP?
    >
    >
    > You would be better off using DTS to do this (bcp if you have a 6.5 server).
    > Alternatively, with SQL 7 and above, there is a T-SQL command called "Bulk
    > Insert" which can be called from asp just as any other query would be
    > called. You should be able to find a lot of information about this command
    > in SQL Books Online (BOL).
    >
    > I'm aware that a Google search will yield examples of using ADO or FSO to
    > open a text file and loop through its contents writing the data to a
    > database, but those solutions are not likely to perform as well as DTS or
    > Bulk Insert.
    >
    > Bob Barrows
    >
    >
    >
    Dave Karmens Guest

  5. #4

    Default Re: Read CSV to SQL

    You can connect to a csv file (which can be opened in Excel and which an
    Excel file can be converted into) in good form just as you can to a
    regular database.

    The .csv file needs to be uploaded to the server.

    And you can have two recordsets open at the same time.

    So I'd suggest going through this recordset one row at a time and within
    this loop add a new record to the "real" database's recordset.

    And for help connecting to a text file using the Jet OLE DB provider:
    [url]http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#O[/url]
    LEDBProviderForMicrosoftJetText

    And based on the above link realize that the actual filename does NOT go
    in the connection string - rather it goes in the SQL statement
    (definitely a little tricky).

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    [url]http://www.Bullschmidt.com[/url]
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt 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