Hello,
I want to increment a hex number by 8 (given as String in @strVar1).
Casting hex numbers seems impossible to mee, since I did not succeed with the following statements:
set @strVar1 = '3b24a3b81c'
set @binVar1 = cast ('0x' + @strVar1 as binary)
set @IntVar1 = cast (@binVar1 as integer)
print '@strVar1= ' + '@binVar1= ' + '@IntVar1= '
print '@strVar1= ' + @strVar1
print @binVar1
print @IntVar1
set @IntVar2 = @IntVar1 + 8
set @binVar2 = cast (@IntVar2 as binary)
set @strVar2 = cast (@binVar2 as char)
print '@strVar2= ' + '@binVar2= ' + '@IntVar2= '
print @IntVar2
print @binVar2
print "@strVar2= " + @strVar2
----- the results are: -------------------------------
@strVar1= @binVar1= @IntVar1=
@strVar1= 3b24a3b81c
0x30 ... I would expect 0x3b24a3b81c
48 ... OK
@strVar2= @binVar2= @IntVar2=
56 ... OK
0x00 ... I would expect 0x38
@strVar2= ... I would expect @strVar2= 0x00
Can anyone explain what happens or give a hint
for a better solution ?
AnStr
I want to increment a hex number by 8 (given as String in @strVar1).
Casting hex numbers seems impossible to mee, since I did not succeed with the following statements:
set @strVar1 = '3b24a3b81c'
set @binVar1 = cast ('0x' + @strVar1 as binary)
set @IntVar1 = cast (@binVar1 as integer)
print '@strVar1= ' + '@binVar1= ' + '@IntVar1= '
print '@strVar1= ' + @strVar1
print @binVar1
print @IntVar1
set @IntVar2 = @IntVar1 + 8
set @binVar2 = cast (@IntVar2 as binary)
set @strVar2 = cast (@binVar2 as char)
print '@strVar2= ' + '@binVar2= ' + '@IntVar2= '
print @IntVar2
print @binVar2
print "@strVar2= " + @strVar2
----- the results are: -------------------------------
@strVar1= @binVar1= @IntVar1=
@strVar1= 3b24a3b81c
0x30 ... I would expect 0x3b24a3b81c
48 ... OK
@strVar2= @binVar2= @IntVar2=
56 ... OK
0x00 ... I would expect 0x38
@strVar2= ... I would expect @strVar2= 0x00
Can anyone explain what happens or give a hint
for a better solution ?
AnStr