CONVERT CHAR(_) to BINARY(_) with specific encoding

Viewed 41

I have an SQL Server database with COLLATE SQL_EBCDIC037_CP1_CS_AS and a column "x" CHAR(4) COLLATE SQL_EBCDIC037_CP1_CS_AS and value '0123', but when I do

CONVERT(BINARY(4), x)

I get 0x30313233 (presumably Latin1) rather than 0xF0F1F2F3 (EBCDIC).

I am executing the query in SQL Server Management Studio. What can I do to get the EBCDIC bytes of column "x" or any given string?

0 Answers
Related