flwor

FLWOR in Sql server count number of hits

依然范特西╮ 提交于 2019-12-07 11:45:20
问题 I am using SQL Server 2008 R2. My problem is that I want to count number of hits that i receive from XQuery query using FLWOR. For each hit, I want a consecutive number, like: 0,1,2,3,4... My query: select @xml.query('for $s at $count in /Root/Persons/Person return <Person ID="{$count}">{$s}</Person>') The only problem here is this is not supported in SQL Server and I receive an error: Msg 9335, Level 16, State 1, Line 16 XQuery [query()]: The XQuery syntax 'at' is not supported. I've also

FLWOR in Sql server count number of hits

∥☆過路亽.° 提交于 2019-12-05 17:47:30
I am using SQL Server 2008 R2. My problem is that I want to count number of hits that i receive from XQuery query using FLWOR. For each hit, I want a consecutive number, like: 0,1,2,3,4... My query: select @xml.query('for $s at $count in /Root/Persons/Person return <Person ID="{$count}">{$s}</Person>') The only problem here is this is not supported in SQL Server and I receive an error: Msg 9335, Level 16, State 1, Line 16 XQuery [query()]: The XQuery syntax 'at' is not supported. I've also tried with let keyword and define new variable but I don't know how to increase value of that variable