将Row_number()添加到SQL Server 2012中的表变量

时间:2015-11-03 01:01:59

标签: sql xml sql-server-2008 sql-server-2012

我有一个存储过程,在添加@gen_test def test_async_sleep(self): start = time.time() resp1, resp2 = yield [ self.http_client.fetch(self.get_url('/async')), self.http_client.fetch(self.get_url('/async')), ] diff = time.time() - start 时显示错误:

row_number

如果无法做到这一点,我怎样才能将alter proc xmliterate @xmlstring xml as begin declare @tablexml table(ids int, names varchar(50), parent varchar(50), nodes varchar(50)) insert into @tablexml (ids, names, parent, nodes) select ids = row_number() over (order by names),---error Invalid column name 'names'. PARENT = B.value('(.)[1]','varchar(50)'), names = b.value('local-name(.)','varchar(50)'), nodes = b.value('local-name(..)','varchar(50)') from @xmlstring.nodes('SampleXML/*/*')A(B) select * from @tablexml end 添加到结果表变量?

1 个答案:

答案 0 :(得分:2)

您的名称列是别名列。您应该更改以下代码:row_number() over (order by names)row_number() over (order by b.value('local-name(.)','varchar(50)'))