Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql XQuery[nodes()]:靠近'的语法错误&书信电报;eof>';,需要一个步长表达式_Sql_Sql Server_Sql Server 2008_Xpath_Syntax Error - Fatal编程技术网

Sql XQuery[nodes()]:靠近'的语法错误&书信电报;eof>';,需要一个步长表达式

Sql XQuery[nodes()]:靠近'的语法错误&书信电报;eof>';,需要一个步长表达式,sql,sql-server,sql-server-2008,xpath,syntax-error,Sql,Sql Server,Sql Server 2008,Xpath,Syntax Error,运行以下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

运行以下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.
XQuery[nodes()]:靠近“”的语法错误,应为步骤表达式。
来自:

问题是xpath末尾的
/
。i、 e

from @xml.nodes('/*/Event/') [Events]([Event])
应该是:

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

回答我自己的问题,因为我在谷歌上只能找到一个关于这个错误的结果&那不是StackOverflow。接受这个作为答案,然后关闭这个问题,如果这对我有效的话you@Piyush:可以;遗憾的是,我似乎需要等待两天才能被允许。我的想法是把它记录在这里,以帮助那些以“site:stackoverflow.com”结束谷歌搜索的人,但人们似乎通常只在不知道答案的时候问,然后在几天后如果没有找到建议答案的话再回答。