Table Row Count

Amit Singh1
Tera Contributor

Hi,

How to row counts for each table in servicenow

Please give me solution

1 ACCEPTED SOLUTION

Rahul Kumar17
Tera Guru

Hi Amit 

U r going to this link

https://community.servicenow.com/community?id=community_blog&sys_id=19ace225dbd0dbc01dcaf3231f961948

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

View solution in original post

7 REPLIES 7

So just give the table name in the query above and you will get the desired results. 

 

gr.AddQuery('name', 'IN', 'incident,problem'); 

 

And you are already doing a count so you should be good to go.

 

Thanks.

FYI my query is counting all the table rows and not particular table. All the tables are by default stored in sys_db_object. If you look at the query which I supplied I am first querying that table to get all the table names and then I am querying individual table to get the row count. As you said that you want it for incident, problem then you can add a filter in that and the query will run only for those table names. 

 

Hope it makes sense. Reach out to me if you have any questions.

Rahul Kumar17
Tera Guru

Hi Amit 

U r going to this link

https://community.servicenow.com/community?id=community_blog&sys_id=19ace225dbd0dbc01dcaf3231f961948

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar