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)
 Clear content of source after import

Author  Topic 

danyriv
Starting Member

2 Posts

Posted - 2009-05-18 : 14:38:09
Hi,

I have a DTS that imports data from a BDF file into Database. The problem I have is that I need to clear the BDF after the importing, but I haven't find a way to do it.

Notice that I cannot delete the file, since it is being filled by another process that needs the file to exist, so my only option is to clear it after the import.

I tried it by creating a 'Execute SQL Task' with a 'DELETE FROM TableName' that is called after the import, but after running the process, the DBF remains exactly the same (all the records are still there).

Is there anyway I can do what I am trying to do with a DTS?

Thanks in advance for any help.

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2009-05-18 : 15:17:12
What format is the DBF file? You could probably open an ODBC connection to it and issue your delete statement through that.

But what happens if the other process that is filling the table is trying to fill it while your DTS package is trying to empty it? Are you really, REALLY sure you want to clear it out?

If you're just trying to be sure that you do not import the same record twice, there are other approaches that you can use for that.

--------------------------------------------
Brand yourself at EmeraldCityDomains.com
Go to Top of Page

danyriv
Starting Member

2 Posts

Posted - 2009-05-19 : 08:08:35
Hi AjarnMark, thanks for your response.

The DBF is a Visual FoxPro table (a single table, not a database). I am using a "Microsoft OLE DB Provider For Visual FoxPro" connection for it.

You are right about the concurrency problem. The issue we now have is that, when the DBF reaches a certain size ( I think around 8MB) it starts giving some problems, like corrupted or missing information, so we need to find a way to empty it every once in a while, to avoid this problem. Currently we are doing it by hand and we want to automatize it.

Let say that at 12:00 AM we are sure nobody will be writing the document, and that's a good time to delete all its contents, I still haven't find a way to do it. As I mentioned before, the document must always exists and must have certain columns on it for the writting process work correctly.

Any suggestions?

Thanks again.
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2009-05-19 : 11:24:06
I haven't done much with FoxPro, but the first thing that pops to mind is to use the T-SQL OPENQUERY function, or maybe OPENROWSET in order to connect to the FoxPro table and delete the records.

--------------------------------------------
Brand yourself at EmeraldCityDomains.com
Go to Top of Page
   

- Advertisement -