Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The traditonal 4 bit hex is pretty direct. Hex String to Integer (Assuming value is stored in field called FHexString) : </p> <pre><code>CONVERT(BIGINT,CONVERT(varbinary(4), (SELECT master.dbo.fn_cdc_hexstrtobin( LEFT(FMEID_ESN,8) )) )) </code></pre> <p>Integer to Hex String (Assuming value is stored in field called FInteger):</p> <pre><code>(SELECT master.dbo.fn_varbintohexstr(CONVERT(varbinary,CONVERT(int, FInteger )))) </code></pre> <p>Important to note is that when you begin to use bit sizes that cause register sharing, especially on an intel machine, your High and Low and Left and Rights in the registers will be swapped due to the little endian nature of Intel. For example, when using a varbinary(3), we're talking about a 6 character Hex. In this case, your bits are paired as the following indexes from right to left "54,32,10". In an intel system, you would expect "76,54,32,10". Since you are only using 6 of the 8, you need to remember to do the swaps yourself. "76,54" will qualify as your left and "32,10" will qualify as your right. The comma separates your high and low. Intel swaps the high and lows, then the left and rights. So to do a conversion...sigh, you got to swap them yourselves for example, the following converts the first 6 of an 8 character hex:</p> <pre><code>(SELECT master.dbo.fn_replvarbintoint( CONVERT(varbinary(3),(SELECT master.dbo.fn_cdc_hexstrtobin( --intel processors, registers are switched, so reverse them ----second half RIGHT(FHex8,2)+ --0,1 (0 indexed) LEFT(RIGHT(FHex8,4),2)+ -- 2,3 (oindex) --first half LEFT(RIGHT(FHex8,6),2) --4,5 ))) )) </code></pre> <p>It's a bit complicated, so I would try to keep my conversions to 8 character hex's (varbinary(4)). </p> <p>In summary, this should answer your question. Comprehensively. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload