开发者

how do i get the rowcount of table variables?

how do i get the rowcount of table开发者_JAVA百科 variables?


If you mean SQL Server table variables, it's just like a normal table:

DECLARE @Foo TABLE
(
  foo int
);

insert into @Foo values (1);
insert into @Foo values (1);
insert into @Foo values (1);
insert into @Foo values (1);

select COUNT(*) from @Foo;


SELECT COUNT(*) OVER ( ) AS 'RowCount' FROM @yourTableVariable

works perfect for table variables!


SELECT COUNT(*) FROM TABLE_NAME;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜