Tables in the ServiceNow Database

Casper6060
Mega Sage

Hi everyone

As part of some work i'm doing, i'm trying to understand the ServiceNow database better.

So far i have understood that there of course are base classes which are tables with no parent.

These tables could have none, one or more children.

Then there is a child class which is a child of a parent.

And then there is a parent class which itself is a child of a class, but also has children itself.

There are probably more examples.

 

Then there are some tables that have physical tables, and some do not.

 

For an example task is a physical table, since you can query it in the database with SELECT * FROM task; and get a result. Whereas incident is a logical table since it's part of the task table and can only be found with a where statement on the task table. SELECT * FROM task WHERE sys_class_name = 'incident';

 

I had the assumption that all base tables would always be physical tables, and all child tables would be logical tables, however, this is not true. For an example

 

The table "discovery_credentials" is indeed a base class and has a physical table. But the "windows_credentials" table which extends the "discovery_credentials" thereby being a child table, ALSO has a physical table in the database.

 

So my first question would be, is there any knowing which is which?

 

Because i know that the table sys_db_object contains information about every single table in ServiceNow.

 

However on an ootb vancouver install. I found this table "ecc_agent_privileged_command_m2m" and it is a base class, but has no physical table in the database, so i'm not sure how to even find the data.

1 ACCEPTED SOLUTION

Bert_c1
Kilo Patron

See:

 

TaskTableFlattening.html

 

Enjoy

 

And look in 'sys_storage_alias' for field mapping, and in sys_storage_table_alias for db tables.

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Casper6060 

 

So my first question would be, is there any knowing which is which?

Atul: As a ServiceNow trainer with 10 years of experience, I believe it’s not necessary to focus on identifying which tables are physical or not. What’s more important is understanding the base and core tables, how they are linked to each other, and how making changes in one table can impact others. Additionally, with ServiceNow moving to the Raptor DB, getting too detailed could lead to confusion and might distract from the platform's main purpose.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Casper6060
Mega Sage

That may be true, but at the moment i'm working on creating a tool for on-prem customers that would function a lot like the current cloud cloning does, so if you exclude a table, it pulls only the structure and not the data.

And whatever table with condition you preserve, that data would then be pulled from the target instance first and then reapplied after the clone is complete.

And for this i need to understand what is happening with tables like "ecc_agent_privileged_command_m2m"

Bert_c1
Kilo Patron

See:

 

TaskTableFlattening.html

 

Enjoy

 

And look in 'sys_storage_alias' for field mapping, and in sys_storage_table_alias for db tables.

Casper6060
Mega Sage

Wow that was just what i needed, thanks a lot Bert! if you have any other useful tables like this please let me know 🙂