hi, I have mn name workweek in a table i want to compare the value of current workweek with the max of workweek and if they are equal i need to delete the data from the same table in SSIS...,Hii,
This is the code I am trying but it deletes all the data from table
I think the problem occurs as neither the left or right hand side of the WHERE clause references your table. Once you work through the case statements, based on today's date you end up with the WHERE clause of:
I assume your MAX(WW) also equals '2012 42' and therefore the WHERE clause becomes
which will be true for all rows and therefore all rows are deleted.
It's hard to suggest an alternative without knowing more about your data, but I would expect you want something like this:
This will delete all records where the WK in the table matches the current WK. I don't know if you have a [Year] column, but you'll need something like that to stop it also deleting this WK for previous years.
answered Oct 17, 2012 at 08:20 AM