给定这样的表结构:
DECLARE @Employees TABLE(EmployeeID INT ,EmployeeDetails XML)
INSERT INTO @Employees( EmployeeID ,EmployeeDetails )
VALUES ( 1 ,'<Employee><EmployeeDetails><EmployeeName> Priyanka </EmployeeName><Age> 24 </Age><Address> Argentina</Address></EmployeeDetails></Employee>')
INSERT INTO @Employees
( EmployeeID ,EmployeeDetails )
VALUES ( 2 ,'<Employee><EmployeeDetails><EmployeeName> Sarkar </EmployeeName><Age> 28 </Age><Address> Australia</Address></EmployeeDetails></Employee>')
如何创建查询以获取 EmployeeDetails 标记下的所有标记名称(不是值)的列表?(假设所有记录的结构都相同)。
因此,期望的结果是:
EmployeeName
Age
Address
山姆