BASE2DECIMAL
Updated 2023-10-13 19:47:38.977000
Syntax
SELECT [westclintech].[wct].[BASE2DECIMAL] (
<@text, nvarchar(4000),>
,<@Radix, int,>)
Description
Use the scalar function BASE2DECIMAL to convert a text representation of a number in a given base into a decimal number.
Arguments
@Radix
The radix (base) used to generate the text representation.
@text
The text representation of a number in the specified radix (base).
Return Type
float
Remarks
LEN(@text) > 0.
2 = @radix = 36.
If @radix IS NULL then @radix = 10.
Examples
Example #1
In this example we convert the hexadecimal number 'FF'.
SELECT wct.BASE2DECIMAL('FF', 16) as [BASE2DECIMAL];
This produces the following result.
{"columns":[{"field":"BASE2DECIMAL","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"BASE2DECIMAL":"255"}]}