<commit_before><commit_msg>new post - all tables row count<commit_after>---
layout: post
title: Get row count for all tables
---

I findthe need to get the row count for all tables of a database from time to time and I found a neat way of doing just that using this little code snippet =)

```sql
SELECT o.NAME, i.rowcnt 
FROM sysindexes AS i
  INNER JOIN sysobjects AS o ON i.id = o.id 
WHERE i.indid < 2  AND OBJECTPROPERTY(o.id, 'IsMSShipped') = 0
ORDER BY o.NAME
```
{'fraction_non_alphanumeric': 0.08297872340425531, 'fraction_numerical': 0.00425531914893617, 'mean_word_length': 3.6176470588235294, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5436167', 'n_tokens_mistral': 158, 'n_tokens_neox': 152, 'n_words': 74}