Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 count rows returned from a select statement?

Author  Topic 

Planet_x
Starting Member

15 Posts

Posted - 2009-09-04 : 11:09:26
Just trying to get the count of rows returned from a select statement but not sure how to do the syntax properly. Trying something like
SELECT count(select * from table_name where column = @var)

but this is not working, is there another way to do this? Any help appreciated, thanks.

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-09-04 : 11:47:12
you can use

select count(*) from table_name where column = @var


If you want to find the number of rows returned from a query..once the query is executed u can do a
select @@ROWCOUNT
to get the number of rows affected.
Go to Top of Page
   

- Advertisement -