数据库中xml字段的值为
<CustomCol>
<Col name="Alias-2-10">33</Col>
<Col name="Alias-2-11">33</Col>
<Col name="Alias-2-12">2011-09-15</Col>
<Col name="Alias-2-13">d3</Col>
<Col name="Alias-2-14">c2,c3,c4,</Col>
<Col name="Alias-2-18">test33</Col>
</CustomCol>
现在的需求是:提供一个name查出值,例如我提供的name=Alias-2-10,那么我要的结果是33
select CColumnsValues.value('(/CustomCol/Col)[1]', 'nvarchar(max)') AS FirstPitcher FROM Contacts
select CColumnsValues.value('(/CustomCol/Col[@name="Alias-2-14"])[1]', 'nvarchar(max)') AS FirstPitcher FROM Contacts