先看下数据表:

SQL对表中XML列的查询

详细XML:

<Roles>
<Role>CA</Role>
<Role>CentralSite</Role>
<Role>DC</Role>
</Roles>

查询1:

Select Roles.value('(/Roles/Role)[1]', 'nvarchar(20)')
From dbo.MachineConfigs

结果:

SQL对表中XML列的查询

 

查询2:

select (select Roles from MachineConfigs where
ID='F16C7025-4E67-4F7F-814D-04D6B5B9387C' ).query('(/Roles/Role[1])')

结果:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-20
  • 2021-08-03
相关资源
相似解决方案