如何使用XQuery选择XML节点的内部文本?
Microsoft Books Online显示了如何在下面检索属性:
DECLARE @myDoc xml DECLARE @ProdID int SET @myDoc = '' SET @ProdID = @myDoc.value('(/Root/ProductDescription/@ProductID)[1]', 'int' ) SELECT @ProdID 1 year parts and labor 3 year parts and labor extended maintenance is available
如何获取Warranty节点的内部文本值?
像这样的东西:
DECLARE @Warranty VARCHAR(50) SET @Warranty = @myDoc.value('(/Root/ProductDescription/Features/Warranty/text())[1]', 'varchar(50)' ) SELECT @Warranty
渣