• montse 22199 (12/12/2012)


    Thanks a lot!! this one is working fine!! Now I have another question :w00t:

    I already have a view (ED) with the following syntax:

    SELECT ContactId,Effective_Date,Semester,'EffectiveGraduationDate'= DATEADD(year, 4, EGD) from ED

    Instead of 'EffectiveGraduationDate'= DATEADD(year, 4, EGD)

    I need to place the if syntax you gave me...

    How it would be?

    Sorry I am trying hard here 🙁

    Sure, try this:

    SELECT ContactId,Effective_Date,Semester,

    EffectiveGraduationDate= CASE WHEN DATEPART(month, EGD) <= 7 THEN DATEADD(year, 4, EGD)

    ELSE DATEADD(year, 5+DATEDIFF(year, 0, EGD), 0)-1 END

    from ED

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn