Help in DataDrivenQuery

  • I'm getting started with DTS and i need help...

    I'm using employee table and i want delete employees who's hire_date<1-1-1990. That is:

    DELETE FROM employee WHERE (hire_date<1-1-1990)

    or in a parameterized way:

    DELETE FROM employee WHERE (hire_date<?)

    So i did the following: (DATA DRIVEN QUERY)

    1) Source is [pubs].[dbo].[employee]

    2) Create a binding table [pubs].[dbo].[fired] with only 1 column, the hire_date

    3) My transformation has hire_date as source column and as binding column and the script:

    Function Main()

    DTSDestination("hire_date") = DTSSource("hire_date")

    If (DTSSource("hire_date")<1-1-1990) Then

     Main = DTSTransformstat_DeleteQuery

    Else

     Main = DTSTransformstat_SkipRow

    End If

    End Function

     

    4) My Delete Query is

    DELETE

    FROM employee

    WHERE     (hire_date<?)

    5) I didn't define lookups or other options

     

    After i run the package i get an empty table nemd fired an no changes at amployee.

    What is wrong???

    Please help me...

    Thankx

    Claudia


    Regards,

    Cláudia Rego

    www.footballbesttips.com

  • This was removed by the editor as SPAM

  • What are you trying to do?

    I am guessing that you want to delete rows from the employee table and insert those rows into fired table.

    If so, you are better off just running a couple of simple queries.

    IE -

    Insert into fire

    select * from employee where hire_date<1-1-1990

    delete from employee where hire_date<1-1-1990


    ------------------------------
    The Users are always right - when I'm not wrong!

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

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