0

I am working on a Windows Server 2012 64-bit. I want to be able to import data from a .dbf file into a SQL Server table. I used the import wizard and it worked correctly. However, I have SQL Server Express and can't schedule this insertion.

Is there another way to schedule the insertion of the .dbf data to the SQL Server tables, without the use of the SSIS package loader?

Update

I ended up using Python and writing a script to import from XML. However, I believe the answer by @Oleg was the most accurate, given the circumstances.

Thank you all!

fcdimitr
  • 528
  • 3
  • 16
  • You can always write a little C# wrapper that will call the SSIS package, and then schedule that wrapper (using Windows "Scheduled Tasks") to be executed on a particular schedule – marc_s Nov 05 '14 at 10:18
  • Thank you very much. I was hoping there would be another way, but I think this the only way to do it. Regards. – fcdimitr Nov 05 '14 at 10:22

3 Answers3

1

I suggest you the next approach:

  1. Create C# script which will use the OleDbConnection (to fetch) and SqlConnection (to upload) objects to import data from the .DBF file to SQL Server database table.
  2. By using LinqPad, LinqPad command-line utility (lprun.exe) and windows Scheduled Task service automate the execution of the mentioned script file

Useful links:

How to get data from DBF file using C#

How to load data into datadase using C#

About LINQPad command-line utility

Andrey Morozov
  • 7,839
  • 5
  • 53
  • 75
1

Another way is create a SQL linked server an ODBC that is pointing at the DBF. Use Windows scheduler to call SQLCMD.EXE to run some SQL to copy the data in.

Nick.Mc
  • 18,304
  • 6
  • 61
  • 91
1

You can also use DBF Commander Pro for this task:

  1. Create command line for your insertion - choose 'File -> Export to DBMS'. Specify transfer options in the window appears, then copy the command line from the bottom of the window: export DBF to database

  2. Create text .BAT file and insert the copied command line, e.g.:

    "c:\Program Files\DBFCommander\DBFCommander.exe" -edb "D:\Data\customer.dbf" customer_table "Provider=SQLOLEDB.1;User ID=user1;Initial Catalog=test_db;Data Source=test_server"

  3. Make a schedule using Windows Scheduler that will execute this .BAT file.

Additional info that may be useful for you:

Using DBF in batch mode
Export DBF file to SQL database

Oleg
  • 823
  • 6
  • 5