> On Thu, 4 Jul 2013 10:34:21 +0200, "Olaf Kluge" <olaf.kl...@satron.de > <mailto:olaf.kluge%40satron.de>> > wrote: >> for example there are two variables. >> >> Var1 = 0 >> >> Now I would like to negate the Var1 to Var2. If var1 = 0, then should > Var2 >> = >> 1 and in the other direction. >> >> Ist it possible Var2 = invert(var1)?? > > Is this just about 0 and 1 or other values as well, if so what is the > exact transformation you need? > > In this specific case, assuming var1 is always 1 or 0 you can use > BIN_XOR(var1, 1) to achieve the desired effect.
I would generally recommend something along the lines of CASE WHEN var=0 THEN 1 ELSE 0 END This will work even if the variable contains unexpected values (I know, it can't happen...). Josef