invantive-dokumentationen del af invantive cloud
Invantive Support ForumsLog ind / Tilmeld dig

SIGN

Syntaks

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> SIGN[SIGN]:::quoted
    SIGN --> End((END))

Formål

SIGN SQL-funktionen returnerer fortegnet for et tal, hvor -1 angiver et negativt tal, 1 et positivt tal og 0 nul.

Se også ABS.

Parametre:

  • Input (decimal): Et tal.

Returnerer: fortegnet som et int32.

Eksempler

Følgende eksempel henter fortegnet for et negativt tal, nul og et positivt tal:

select sign(-0.65565) negative
,      sign(0) neutral
,      sign(+20) positive

-------- -------- --------
-1       0        1

Følgende eksempel returnerer null, da input er null:

select sign(null)

--------