Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Sqlserver 2012 varbinary concatenation does not work as expected

$
0
0

I'm seeing an strange behaviour when performining varbinary concatenation as per the following test case: Is there a bug or do I need to use another function? 

declare @l_header varbinary(32) declare @l_BASE varbinary(28) = 0x5800355E01EE35C1355E01EED70700000001FF00FF00FFFFFFFFFFFF; declare @l_SEQ#BIN VARBINARY(4) SET @l_SEQ#BIN = convert(varbinary(4), 1055); SET @l_header = @l_BASE + @l_SEQ#BIN select LEN(@l_BASE) AS BASE_LEN, LEN(@l_SEQ#BIN) AS SEQ#BIN_LEN, len(@l_header) AS HEADER_LEN, @l_SEQ#BIN AS SEQ#BIN SET @l_SEQ#BIN = convert(varbinary(4), 1056); SET @l_header = @l_BASE + @l_SEQ#BIN select LEN(@l_BASE) AS BASE_LEN, LEN(@l_SEQ#BIN) AS SEQ#BIN_LEN, len(@l_header) AS HEADER_LEN, @l_SEQ#BIN AS SEQ#BIN

BASE_LEN SEQ#BIN_LEN HEADER_LEN SEQ#BIN
28 4 32 0x0000041F

BASE_LEN SEQ#BIN_LEN HEADER_LEN SEQ#BIN
28 3 31 0x00000420


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>