There are multiple methods to find out the number of records in a table.
Let us first consider a table Organization.
Select OrgId,Acctnum,CompId,OrgName,Phone From Organization
Output:
As shown in the above output, the Organization table Contains 5 records.
Now, To find out the Number of records in the table Organization, we can follow the below methods.
1. Using Count(*)
Example : Select Count(*) RecordCount From Organization
Output:
2. Using the System Stored Procedure
Example : Exec SP_SpaceUsed 'Organization'
Output:
3. Using System Views
Example : Select Max(Rows) RecordCount From SysObjects So, SysIndexes Si
where so.type='U' and si.id=object_id('Organization')
Output:
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.