declare @hdoc int, @xmlchar nvarchar(max)
set @xmlchar = '<root> <row _Fld394=" 61640200" /></root>'
exec sp_xml_preparedocument @hdoc out, @xmlchar
select _Fld394
from openxml(@hdoc, '/root/row')
with
(_Fld394 nvarchar(9) '@_Fld394')
exec sp_xml_removedocument @hdoc
//result = '61640200'
//must be = ' 61640200'
If you look at _Fld394 recorded 9 characters - from the front space When extracting it clipped the left with spaces.
How to solve the problem?