I have an SSIS for loop and in the assign expression part of the for loop I need to increment with a DATEADD function but the date part needs to be dependent on my variable:
@DateStart = DATEADD(@TypeIncrement,@DayIncrement,@DateStart)
If i change it ,it will work:
@DateStart = DATEADD(dd,@Increment,@DateStart)
but if I try to do it this way its just giving me an error saying The date part parameter specified for function "DATEADD" is not valid.
I have also tried changing it to be a case statement with different date parts but that wouldn't work either. Any ideas?
Thanks.
----------------EDIT
a lot of ppl are posting sql server answers. but i need it working here:

CASE @TypeIncrementreally is your friend here. What's the thing you tried that "wouldn't work"? (And presumably@DayIncrementis a misnomer if it can be about other things than days?)CASE @TypeIncrement when 'DAY' THEN DATEADD(DAY, ...) WHEN 'MONTH' THEN ...etcetera. The first parameter must be a literal, but you can definitely useCASE.