Click here to Skip to main content
14,665,327 members
Rate this:
Please Sign up or sign in to vote.
See more:
what is the query that is used to count the number of rows of a table in a data base
Posted
Updated 27-Oct-12 8:35am
v3
Comments
jackfrnz 27-Oct-12 14:31pm
   
what do you mean by "base table data" ?

Rate this:
Please Sign up or sign in to vote.

Solution 1

count the number of rows of a table
SELECT COUNT(*) FROM myTable

Refer: MSDN: COUNT (Transact-SQL)[^]
   
Comments
Mounayangui 27-Oct-12 14:55pm
   
i want to affect the number of the row in an integer variable
Sandeep Mewara 27-Oct-12 14:59pm
   
1. You comment is 'Not clear'.
2. Your question just asks for a query to find count.
adriancs 27-Oct-12 21:47pm
   
Yes, this query will return an integer.
adriancs 27-Oct-12 21:46pm
   
shot at target. vote 5
Rate this:
Please Sign up or sign in to vote.

Solution 3

SELECT COUNT(*) into nbr FROM myTable
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100