因為看到某個文章編碼轉換~我想這UNICODE換成BIG5的話~
有無方法?
declare @Str Nvarchar(50) = N'測試員'
select CONVERT(VARBINARY, @Str) Str
,'0xB4FAB8D5ADFB' 目標字串
https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=e7580975e716e50f89f51d7745a86616
將0x2C6E668AE154換成0xB4FAB8D5ADFB
其實我有UNICODE跟BIG5對照表轉換@@..
http://shiaobin.github.io/internal-code-converter/
對照表JS
http://shiaobin.github.io/internal-code-converter/internal-code-conveter.js
文字檔對照表
https://moztw.org/docs/big5/table/big5_2003-b2u.txt
1/7更新..哈~亂試定序~找到方法@@"
declare @Str nvarchar(50) = N'測試員'
select CONVERT(VARBINARY, @Str ) Str1
,CONVERT(VARBINARY, Convert(varchar,@Str collate Chinese_Taiwan_Stroke_CI_AS) ) Str2
https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=13f74b63d6e39fa02725680a2fbd10cd
補充~進位型態轉文字型態可這樣獲得~
declare @Str nvarchar(50) = N'測試員'
select CONVERT(varchar,CONVERT(VARBINARY, Convert(varchar,@Str collate Chinese_Taiwan_Stroke_CI_AS)),0) Str0
,CONVERT(varchar,CONVERT(VARBINARY, Convert(varchar,@Str collate Chinese_Taiwan_Stroke_CI_AS)),1) Str0
,CONVERT(varchar,CONVERT(VARBINARY, Convert(varchar,@Str collate Chinese_Taiwan_Stroke_CI_AS)),2) Str0
https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=0f93407a316d7b448e46cb238406b26d