none
Problems with if - then - else RRS feed

  • Frage

  • Hello everybody!

    Could anyone tell me why the following script doesn't work:

    update Angebot
    IF TH_AH > 1 set PR_TH = ((TH_AH-1)*45) 
    Else
    IF TH_AH <= 1 set PR_TH = 0
    end if
    Same thing in Sybase SQL is working ...

    I got no idea ...

    Thanks

    Joerg
    Donnerstag, 24. September 2009 04:58

Antworten

  • UPDATE Angebot
    SET PR_TH = CASE WHEN TH_AH > 1 THEN (TH_AH -1) * 45 ELSE 0 END
    -- Frank Kalis Microsoft SQL Server MVP Webmaster: http://www.insidesql.org
    Donnerstag, 24. September 2009 06:41

Alle Antworten

  • UPDATE Angebot
    SET PR_TH = CASE WHEN TH_AH > 1 THEN (TH_AH -1) * 45 ELSE 0 END
    -- Frank Kalis Microsoft SQL Server MVP Webmaster: http://www.insidesql.org
    Donnerstag, 24. September 2009 06:41
  • http://social.technet.microsoft.com/Forums/de-DE/transactsql/thread/bb9faa33-fbd8-4608-9c75-c8d65fc50cc6

    ...übrigens sind mehrere Threads zum gleichen Thema etwas, was man auch in Webforen nicht gerne sieht. ;-)



    -- Frank Kalis Microsoft SQL Server MVP Webmaster: http://www.insidesql.org
    Donnerstag, 24. September 2009 06:51