SQL Server OCT2DEC Function
Updated 2023-11-08 16:16:17.297000
Description
Use the scalar function OCT2DEC to convert an octal number to decimal.
Syntax
SELECT [westclintech].[wct].[OCT2DEC] (
<@Number, nvarchar(4000),>)
Arguments
@Number
is the octal number you want to convert. @Number cannot contain more than 10 characters. The most significant bit of @Number is the sign bit (30th bit from the right). The remaining 29 bits are magnitude bits. Negative numbers are represented using two's-complement notation. @Number is an expression of type nvarchar or of a type that can be implicitly converted to nvarchar.
Return Type
float
Remarks
If @Number is not a valid octal number, OCT2DEC returns an error.
Examples
select wct.OCT2DEC(54);
This produces the following result.
| column 1 |
|---|
| 44 |
select wct.OCT2DEC(7777777533);
This produces the following result.
| column 1 |
|---|
| -165 |