views:

163

answers:

1

how to convert a binary(128) from little endian to big endian in SQL Server?

A: 

try something like this:

declare @little binary(4)
set @little = 0x02010000

select
  @little [bigEndian],
  cast(reverse(@little) as binary(4)) [littleEndian]

OUTPUT:

bigEndian  littleEndian
---------- ------------
0x02010000 0x00000102

(1 row(s) affected)
KM