开发者

how do i get the rowcount of table variables?

开发者 https://www.devze.com 2023-02-18 11:22 出处:网络
how do i get the rowcount of table开发者_JAVA百科 variables?If you mean SQL Server table variables, it\'s just like a normal table:

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

精彩评论

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

关注公众号