谁能帮我<QuoteId>
使用 T-SQL 和 XQuery 从附加的 XML 文件中检索一个值?
我正在尝试使用这个 T-SQL 但没有运气
declare @QuoteResponse XML
select @QuoteResponse =gQuoteResponse FROM AutoRenew where policyid= '454544'
SELECT b.value('(OverallResultStatus)[1]', 'varchar(100)') as status
FROM
@QuoteResponse.nodes('GetQuoteResponse/OperationResult') as a(b)
这是我用来检索QuoteId
DECLARE @QuoteResponse XML
SELECT @QuoteResponse = gQuoteResponse FROM [dbo].[AutoRenew] WHERE policyid = '454544'
SELECT
@QuoteResponse.value('(GetQuoteResponse/QuoteResults/QuoteResult/QuoteId)[1]', 'bigint')
谢谢
<GetQuoteResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OperationResult>
<OverallResultStatus>xxxx</OverallResultStatus>
<Results>
<Result>
<ResultStatus>xxxx</ResultStatus>
<ResultCode>ddf</ResultCode>
<ResultMessage>xxxxx</ResultMessage>
</Result>
</Results>
</OperationResult>
<QuoteResults>
<QuoteResult>
<OperationResult>
<OverallResultStatus>xxx</OverallResultStatus>
<Results>
<Result>
<ResultStatus>xx</ResultStatus>
<ResultCode>xxxx</ResultCode>
<ResultMessage>xx</ResultMessage>
</Result>
</Results>
</OperationResult>
<MainData>
<StartDate>2012-08-14T00:00:00</StartDate>
<ReturnDate>2013-08-13T00:00:00</ReturnDate>
<TripType>xxx</TripType>
<Area>xxx</Area>
<Relationship>Individual</Relationship>
<Product>
<ProductId>xxx</ProductId>
<Name>xxxx</Name>
</Product>
<Endorsements>
<Endorsement>
<EndorsementCode>xx</EndorsementCode>
<Selected>xx</Selected>
<Name>xxx</Name>
</Endorsement>
<Endorsement>
<EndorsementCode>xxx</EndorsementCode>
<Selected>xxx</Selected>
<Name>xxxx</Name>
</Endorsement>
</Endorsements>
<Promotion>
<PromotionCode />
</Promotion>
<Travellers>
<Traveller requestedMedicalScreening="false">
<TravellerId>xxxx</TravellerId>
<Title>xxx</Title>
<FirstName>xxx </FirstName>
<LastName>xxxx</LastName>
<Age>xxx</Age>
</Traveller>
</Travellers>
</MainData>
<Price>
<NetToParentAgent>xxx</NetToParentAgent>
<NetPrice>xxx</NetPrice>
<Tax>edew</Tax>
<GrossPriceWithAllSurchargesAndMedicalScreenings>103.02</GrossPriceWithAllSurchargesAndMedicalScreenings>
</Price>
<QuoteId>322423234</QuoteId>
<QuoteExpiryDate>xxx</QuoteExpiryDate>
<SummaryOfCover />
</QuoteResult>
</QuoteResults>
</GetQuoteResponse>