Truncated CSV Import Solutions

Results 1 to 2 of 2

Thread: Truncated CSV Import Solutions

  1. #1
    Join Date
    Dec 1969

    Default Truncated CSV Import Solutions

    ... this is a summary of the "Truncated CSV Import" thread on 8/20/03... which did not get solved yet...<BR><BR>When reading a CSV file, values over 255 chars are being truncated. Therefore ProductDesc in the examples below is being truncated.<BR><BR>-------------------------------------<BR>Here&#039;s a sample CSV structure:<BR><BR>ProductCode - 50 chars<BR>ProductName - 100 chars<BR>ProductDesc - 5000 chars<BR><BR>-------------------------------------<BR>Here&#039;s a sample connection:<BR><BR> sDSN = "FileDSN=C:InetpubwwwrootCSV.DSN;" & _ <BR> "DefaultDir=C:Inetpubwwwroot;" & _ <BR> "DBQ=C:Inetpubwwwroot;" <BR><BR> Set Conn3 = Server.CreateObject("ADODB.Connection") <BR> Conn3.Open sDSN, adOpenStatic, adLockReadOnly <BR><BR> SQL = "SELECT * FROM [Products.csv]" <BR> set rs = conn3.execute(sql) <BR><BR>-------------------------------------<BR>Next we tried swaping the last two lines above to instead say the following for the purpose of putting the huge "memo" field as the last select item (which is sometimes a fix when dealing with MSAccess):<BR><BR> SQL = "SELECT ProductCode, ProductName, ProductDesc FROM [Products.csv]" <BR> set rs = conn3.execute(sql) <BR><BR>-------------------------------------<BR>Here&#039;s another thing I tried... putting a schema.ini file inside the same folder where the CSV file is. But that didn&#039;t seem to do the trick (although I thought it did a few nights ago at 2AM... but now that I&#039;m wide awake it doesn&#039;t =).) <BR><BR>Any ideas of the best way to read a CSV that is reliable? Thanks!

  2. #2
    Join Date
    Dec 1969

    Default My ugly solution... to use FSO to read the ".csv" file.<BR><BR>Use VBS to parse the lines into fields and then store those into an Access DB.<BR><BR>From the sounds of things, you wouldn&#039;t want that solution. But if you do, ask again.<BR><BR>Bill<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts