gpt4 book ai didi

sql - XQuery [nodes()] : Syntax error near '' , 需要一个步骤表达式

转载 作者:行者123 更新时间:2023-12-02 21:43:27 24 4
gpt4 key购买 nike

运行以下 SQL/XPath 查询会返回以下错误:

查询:

;WITH XMLNAMESPACES (
'http://schemas.microsoft.com/win/2004/08/events/event' as ns
, default 'http://schemas.microsoft.com/win/2004/08/events/event'
)

select [Events].[Event].value('(./System/TimeCreated/@SystemTime)[1]','nvarchar(100)') EventTime
from @xml.nodes('/*/Event/') [Events]([Event])

错误:

XQuery [nodes()]: Syntax error near '<eof>', expected a step expression.

最佳答案

来自:http://www.experts-exchange.com/Database/MS-SQL-Server/Q_27789732.html

问题出在 xpath 末尾的 /。即

from @xml.nodes('/*/Event/') [Events]([Event])

应该是:

from @xml.nodes('/*/Event') [Events]([Event])

关于sql - XQuery [nodes()] : Syntax error near '<eof>' , 需要一个步骤表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27865127/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com