DECLARE @xml XML
SET @xml='
<Students>
    <Student  >FROM @xml.nodes('/Students/Student/name') AS T(C1)

select  T.C.value('@id','varchar(max)') as StudentId,
        T.C.value('name[1]','varchar(max)') as StudentName,
        T.C.value('age[1]','varchar(max)') as StudentAge,
        T.C.value('birthday[1]','datetime') as StudentBirthDay
from    @xml.nodes('/Students/Student') as T ( C )

 

Note:

1>. 表示当前节点

2> ..表示上级节点

3> @表示属性

4> 第一个节点为[0]

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
猜你喜欢
  • 2021-10-28
  • 2021-11-12
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-10-10
  • 2021-10-10
相关资源
相似解决方案