Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Import csv with separate date header..

Author  Topic 

riddlermarc
Starting Member

2 Posts

Posted - 2002-07-29 : 08:53:32
Hi,

I'm a relative newbie to SQL Server but I'm having to learn it to accomplish some goals for some web development I'm currently doing.

I need to import a csv file (has to be csv, the originating app doesn't export as anything else:() which has a format like so:

Phoenix_Rising
13:18 29 Jul 2002
andyu,1, 73535.27 ,6691,44
TPR_Mulda,2, 37553.49 ,2152,342
Alta_Rica,3, 31177.67 ,2061,433
riddlermarc,4, 26567.64 ,2030,508
etc...
etc...


The third field is the one I want to import (eg 73535.27), the values are to be inserted into a new column in an existing table against the relevant username (andyu, TPR_Mulda etc).

Also, I don't want to import the top row (Phoenix Rising) but I want to import the second row (time/date) to be the name of the new column.

My goal is to populate a table on a daily basis that stores statistical data for my Genome@Home team, I need to record how many units each member produces on a daily basis.. from this I can pull the information out via ASP and have it available on a website (that's the easy part, I'm proficient in ASP/PHP etc..).

I need to automate this import at 5am every morning too as my app that downloads the statistical data is set to run at 4am every day.. can anybody point me in the right direction, please?

Regards,
Marc

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-07-29 : 09:58:31
Use DTS, it has all the necessary facilities built-in to accomplish this task - skipping header rows, parsing csv files, converting said files to rows in a table, logging, error handling, scheduling, etc.

Jonathan Boott, MCDBA
Go to Top of Page
   

- Advertisement -