Importing DBF (FoxPro) Files

  • Hello again,

    Now, I have other problem:

    I want to import some dbf (foxpro) files to SQL Server 2000 and I want to choose the rows that are inside a

    specific date range. To do this, I'm using, inside the DTS, the Transformation Data Task.

    I chose the Other ODBC Connection and, if I wouldn't put the date field in the criteria, everything is fine.

    If I put, a error occurs.

    I use the following query :

    Select number, emission

    from NF

    WHERE (emission = { d getdate()-60})

    and I receive the following error:

    [Microsoft] [ODBC Visual Fox Pro Driver] Syntax error or access violation.

    Somebody could help me?

    Thanks,

    Adriana

  • IF you're trying to do date arithmetic, your syntax is slightly off

    Trythis

    Select number, emission

    from NF

    WHERE (emission > dateadd(dd, -60, getdate())

    To get everything within the past 60 days.

  • I have found the foxpro drivers to be a real pain especialy with date fields.

    Question: Is the code you posted the code you originally typed in or has it been modified by the sql engine?

    You can type perfectly valid sql code into the DTS, but if you then test the code within the DTS it will replace some parts of the code with code that has curly brackets like that which you posted. If you then try to run this code again you will get an error like the one you describe.

    The solution I use is to write my sql in notepad, paste into dts to test, and re-paste before saving DTS.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply