將字符串轉utf-8的函數 SqlServer中字符串是ucs2格式(接近Unicode),如需要轉為utf-8,需要進行轉換: create function fn_toUtf8Bin(@str nvarchar(max)) returns varbinary(max) as begin DECLARE @ucs2 varbinary(max), @r varbinar