Thursday, September 09, 2010 Register
XLeratorDB/engineering Online Documentation
DEC2HEX
No Comments Yet
 
Updated: 01 March 2009 

Use wct.DEC2HEX to convert a decimal number to hexadecimal.
Syntax
SELECT [wctEngineering].[wct].[DEC2HEX] (
   <@Number, float,>
 ,<@Places, float,>)
Arguments
@Number
is the decimal integer you want to convert. If @Number is negative, valid @Places values are ignored and DEC2HEX returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation. @Number is an expression of type float or of a type that can be implicitly converted to float
@Places
The number of characters to use. If @Places is NULL, DEC2HEX uses the minimum number of characters necessary. @Places is useful for padding the return value with leading 0s (zeros). @Places is an expression of type float or of a type that can be implicitly converted to float
Return Types
varchar(4000)
Remarks
·         If @Number is less than -549,755,813,888 or @Number is greater than 549,755,813,887, DEC2HEX returns an error.
·         If @Number is negative, DEC2HEX ignores places and returns a 10-character binary number.
·         @Places is truncated to zero decimal places.
Examples

select
wct.DEC2HEX(-512, NULL)

This produces the following result
---------------------------
FFFFFFFE00
 
(1 row(s) affected)


select
wct.DEC2HEX((power(16.0000,10.0000)/2)-1, NULL)

This produces the following result
--------------------------
7FFFFFFFFF
 
(1 row(s) affected)


select
wct.DEC2HEX(100, 10)

This produces the following result
--------------------------
0000000064
 
(1 row(s) affected)


  Comments

 |  View Topic History  |
Print  
Privacy StatementTerms Of UseCopyright 2010 WestClinTech LLC

BorderBoxedGrayBoxedGreenBlue Small width layoutMedium width layoutMaximum width layoutMaximum textMedium textSmall textBack Top!