1
我想用UTF-8編碼生成XML。但是默認情況下它是在UCS-2中生成的。使用SQL Server生成編碼UTF-8的XML
請幫我用UTF-8編碼生成XML。下面是我的查詢:
select
isnull(cast('5678' as nvarchar(50)),'') [Vlootnummer],
isnull((select top 1 cast(EngineNo as nvarchar(50))
from VTS_DEMO.dbo.VehicleDetails v
join VTS_DEMO.dbo.VehicleDevice vd on v.VehicleId = vd.VehicleId
and ObuID = '353234023894171'), '') as Kenteken,
isnull((select top 1 cast(FillingStationName as nvarchar(50)) Units
from VTS_DEMO.dbo.FillingStation
where GeoFenceId = 3655),'') Locatie,
isnull((select top 1 GeofenceCode
from VTS_DEMO.dbo.GeoFence
where GeoFenceId = 3655), '') GeoFencingID,
isnull(cast(case when 1 = 0 then '' else '2017-02-07T23:15:25Z' end as nvarchar(50)),'') Aankomsttijd,
isnull(cast(case when 1 = 0 then '2017-02-07T23:15:25Z' else NULL end as nvarchar(50)),'') Vertrektijd
FOR XML PATH('Notificatie')
當我使用存儲過程msdb.dbo.sp_send_dbmail
,當它在記事本中打開郵件發送此XML作爲附件++話,就說明UCS-2
。
SQL Server(不包括2016版)不支持** UTF-8 ... –