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)
 DTS or Store Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-21 : 08:25:21
Terence writes "I have to import data into a table on a daily basis. This data is dumped to disk by another process and is saved to disk with the current day's date. (eg.2002_06_06.txt) The data is tilder-delimited. However, there is one field therein that needs to be split into 2 (the date and time is combined to reflect one value,e.g.,06/03/2002 08:00:57:116). I also need to remove the last digit of the time when doing this. I'd like to automate the import of this text file. Do you have a solution for me?

Thanks - Terence"

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-06-21 : 11:57:42
Within a DTS Package, write an ActiveX script to check to see if today's date is loaded into the folder first. If not, fail the package. If so import the file into a staging table. From here you are done with DTS.

Use a stored procedure to run the DTS and return the whether the package failed or not. If the package did not fail, Create a query to get the information from the staging table in the appropriate format and then insert it into the final table. Finally, delete the staging table.

You can then set up a job to run daily, hourly, etc. to run the stored procedure.

Good luck!

Jeremy

Go to Top of Page

schrockA
Starting Member

2 Posts

Posted - 2002-06-23 : 22:28:55
You might import the daily dump data into a temporary table, leaving the date/time data combined as a single field, as originally dumped. Then move the data to your working table, and in the process, parse it with the SUBSTRING function into the date and time elements you need.

Al

Go to Top of Page
   

- Advertisement -