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;
精彩评论