Skip to content

Add SIGN function#745

Merged
MarkMpn merged 1 commit into
MarkMpn:masterfrom
sulimanbenhalim:add-sign-function
Mar 16, 2026
Merged

Add SIGN function#745
MarkMpn merged 1 commit into
MarkMpn:masterfrom
sulimanbenhalim:add-sign-function

Conversation

@sulimanbenhalim

Copy link
Copy Markdown
Contributor

Adds the SIGN function which returns the positive (+1), zero (0), or negative (-1) sign of a numeric expression.

Changes

  • ExpressionFunctions.cs — six overloads covering all supported numeric types: int, bigint, decimal, float, money, real
  • FunctionMetadata.cs — autocomplete/IntelliSense entry
  • ExpressionFunctionTests.cs — unit tests for int, bigint, and float overloads covering positive, negative, zero, and null inputs

Usage

SELECT SIGN(-42)     -- -1
SELECT SIGN(0)       -- 0
SELECT SIGN(3.14)    -- 1
SELECT SIGN(amount)  -- works on any numeric column

@sonarqubecloud

Copy link
Copy Markdown

@MarkMpn MarkMpn merged commit 3cef28e into MarkMpn:master Mar 16, 2026
2 checks passed
@sulimanbenhalim sulimanbenhalim deleted the add-sign-function branch March 16, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants