大约有 100 个这样的列。Blob 中的一列当前如下所示:
<GridDataVisibleColumn>
<FilterBehavior>StronglyTyped</FilterBehavior>
<FilterBarMode>Immediate</FilterBarMode>
<AllowFilter>false</AllowFilter>
<AllowSort>true</AllowSort>
<AllowDrag>false</AllowDrag>
<AllowGroup>true</AllowGroup>
<AllowResize>true</AllowResize>
<ShowColumnOptions>false</ShowColumnOptions>
<HeaderText>XRef</HeaderText>
<IncrementSeed>1</IncrementSeed>
<IsIdentity>false</IsIdentity>
<IsReadOnly>false</IsReadOnly>
<MappingName>XRef</MappingName>
<MinimumWidth>0</MinimumWidth>
<Width>
<UnitType>None</UnitType>
<Value>150</Value>
</Width>
<DataType>String</DataType>
<UpdateMode>LostFocus</UpdateMode>
<IsHidden>false</IsHidden>
</GridDataVisibleColumn>
SQL 查询看起来像:
执行 sp_xml_preparedocument @hdoc 输出,@blobXML
insert into @tmpblob
(
RunDate,
Token,
OwnerId,
MappingName ,
HeaderText ,
WidthUnitType,
WidthValue
)
select
@RunDate,
@Token,
@OwnerId,
MappingName,
HeaderText,
WidthUnitType,
WidthValue
from OPENXML(@hdoc, '/GridDataTableProperties/VisibleColumns/GridDataVisibleColumn/MappingName', 2)
with(
MappingName VARCHAR (64) './text()' ,
HeaderText VARCHAR (64) './text()' ,
WidthUnitType VARCHAR (64) './UnitType/text()' ,
WidthValue VARCHAR (64) './Value/text()'
)
EXEC sp_xml_removedocument @hdoc
只需假设@tmpblob 的一切都是正确的。我也可以发布它,但它不会是 consie。我想知道如何以表格的形式显示此 xml,例如
MappingName HeaderText WidthUnitType WidthValue
XRef XRef 无 150