Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nomber of records in each table
Message
From
26/12/2008 16:31:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01369750
Message ID:
01369801
Views:
6
>>>Is there a SQL command I can use to get a list of all the tables along with the number of records in each table in a database?
>>>
>>>Thanks,
>>>Einar
>>
>>
select rowcnt,object_name(id) 
>>from sysindexes
>>where indid < 2 and object_name(id) not like 'sys%'
Cetin
>
>
>Thanks Cetin. I already awarded the solution stars but a single star is comming your way. Your way is a lot less "code"
>
>Thanks,
>Einar

Einar,
I don't care about the stars:) I posted this one because this one directly uses the sysindexes table to get the rowcounts;) I remember this tricky one from "Inside SQL server 7.0" - MSPress. It is not only less code, it is fastest I have seen.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform