The traditional 4-bit hex is pretty straight forward. Hex String to Integer (The assumed value is stored in the FHexString field):
CONVERT(BIGINT,CONVERT(varbinary(4), (SELECT master.dbo.fn_cdc_hexstrtobin( LEFT(FMEID_ESN,8) )) ))
Hexadecimal integer (Assuming the value is stored in the FInteger field):
(SELECT master.dbo.fn_varbintohexstr(CONVERT(varbinary,CONVERT(int, FInteger ))))
It is important to note that when you start using the bit sizes that cause the registry to be exchanged, especially on a computer with Intel, your High and Low and Left and Rights in the registers will change places due to the insignificant nature of Intel. For example, when using varbinary (3) we are talking about the six-character Hex. In this case, your bits are concatenated as the following indexes from right to left "54.32.10". On intel, you expect "76.54.32.22". Since you only use 6 out of 8, you need to remember to do swaps yourself. "76.54" will qualify as your left, and "32.10" will qualify as your right. A comma separates your high and low. Intel changes highs and lows, then left and right. So, to do the conversion ... sigh, you need to change them yourself, for example, the following will convert the first 6 of six characters:
(SELECT master.dbo.fn_replvarbintoint( CONVERT(varbinary(3),(SELECT master.dbo.fn_cdc_hexstrtobin(
This is a bit complicated, so I would try to keep my conversions in a hexadecimal character (varbinary (4)).
So this should answer your question. Vast.
Neel Edwards Feb 21 '12 at 12:52 2012-02-21 12:52
source share