Thursday, March 8, 2012

Automated DTS Package Problem

I need to create an Automated DTS package. At present I am running it manually each morning to import our phone switch data to an SQL table. The reason I had to go this route is this.

Because the Access tables are locked, I have a System DSN that connects to the System.mda file, this in turn gives me access to the locked tables to extract the data I need into Excel. I then drop the existing SQL table and run the DTS package recreating the SQL table with the data from the Excel file. I do not want to use OLEDB to connect to the Access table from within my application because it changes each month and of course the traffic load, I have as many 150 clients hitting the DB at one time.

I actually need the DTS package to update the SQL table with the latest data.

I'm no DTS guru, so how can I do this automagically?I managed to create the DTS package using my DSN, but I still have a few problems.

1. This is the Query that I need to use, it works every where else except insde the DTS Query Pane:

SELECT * FROM CallLog WHERE
(TTExtDest = '2002') AND (TTAnswered = '1')
AND (TTDateTimeIn >= DATEDIFF(dd, 1, GETDATE()))

It throws an OLEDB error telling me that GETDATE is an Undefined function.

2. I need to insert the above results into another table, this should work right?:

INSERT INTO SD_2004
SELECT * FROM CallLog
WHERE (TTExtDest = '2002') AND (TTAnswered = '1')
AND (TTDateTimeIn >= DATEDIFF(dd, 1, GETDATE()))

If I can overcome this Undefined Function bit, I got it whipped.

No comments:

Post a Comment