# How to retrieve "Database Used (KB)" information?

**URL:** https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056
**Category:** Developers Forum
**Created:** [May 29, 2001, 8:47am UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056 "2001-05-29T08:47:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![karel2](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@karel2](https://www.dynamicsuser.net/u/karel2)
#### Post date: [May 29, 2001, 8:47am UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056/1 "2001-05-29T08:47:59Z")

</div>

Is it possible to retrieve “Database Used (KB)” information (which is normally displayed in Database Info dialog) within C/AL? How to do it?

---

<div class="post-metadata">

### Author: ![Tarek\_Demiati](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@Tarek\_Demiati](https://www.dynamicsuser.net/u/Tarek_Demiati)
#### Post date: [May 29, 2001, 9:35am UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056/2 "2001-05-29T09:35:12Z")

</div>

No, you cannot, all you can do is retrieve the size of the database. Declare Database File as a variable of type record. and do a DatabaseFile.FIND(’-’); then check the value for the field “Size KB” [tarek\_demiati@ureach.com](mailto:tarek_demiati@ureach.com)

---

<div class="post-metadata">

### Author: ![karel2](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@karel2](https://www.dynamicsuser.net/u/karel2)
#### Post date: [May 29, 2001, 1:58pm UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056/3 "2001-05-29T13:58:07Z")

</div>

Thank you Tarek however this will not help me much. What I would like to do is to give administrator a warning when the “Database Used %” ratio reaches 90% limit or so. I tried to count the total of “BLOB size” from “Object” table, add total of “Size (KB)” from “Table Information” table, but the value I received this way was LARGER than the one displayed in the standard dialog box (File, Database, Information). (I tried it with demo database, and the difference was cca 10 - 15%).

---

<div class="post-metadata">

### Author: ![triff](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@triff](https://www.dynamicsuser.net/u/triff)
#### Post date: [May 29, 2001, 4:52pm UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056/4 "2001-05-29T16:52:51Z")

</div>

If you look at Table 2000000028 Table information. This gives you the size of each table, so you can just add these together and get a guestimate of how much of the database has been used. Paul Baxter

---

<div class="post-metadata">

### Author: ![karel2](https://avatars.discourse-cdn.com/v4/letter/k/fbc32d/32.png) [@karel2](https://www.dynamicsuser.net/u/karel2)
#### Post date: [May 30, 2001, 8:20am UTC](https://www.dynamicsuser.net/t/how-to-retrieve-database-used-kb-information/5056/5 "2001-05-30T08:20:00Z")

</div>

I did that. However “2000000028 Table Information” table contains information only about tables (as such), I think. Therefore I added to this value the size of other objects from “2000000001 Object” table: VAR \_Occupied: Integer; \_Table: Record “Table Information”; \_Object: Record Object; \_Occupied := 0; IF \_Table.FIND(’-’) THEN REPEAT \_Occupied := \_Occupied + \_Table.“Size (KB)”; UNTIL \_Table.NEXT = 0; IF \_Object.FIND(’-’) THEN REPEAT IF \_Object.Type \<\> \_Object.Type::Table THEN \_Occupied := \_Occupied + ROUND((\_Object.“BLOB Size” / 1024),1); UNTIL \_Object.NEXT = 0; MESSAGE('Occupied size: ’ + ‘FORMAT(\_Occupied) + ’ KB’); When I suppose that “Table Information”.“Size (KB)” represents amount of space occupied by both data and (table) object definition (as shown in the code above), I receive “better” results. However I still miss something. For example with my demo database, this codeunit reports 24192 KB occupied, compared to 23832 KB displayed in standard NF Database Info dialog.
