Query SQL For Integrity Data Testing For SwitchOver The Server

How I Count All Rows From All Tables From Database UiPath ?


Can you Suggest The Documentation Or Just Give Me any Ideas To Count All Rows From Database UiPath ?

@wayyy

I believe this will help you

Cheers

yahh it works and it helps me , thankyou

1 Like

@wayyy,

Use Database activities for this.

  1. Use Connect Database to connect. Save the output as a Database Connection variable, e.g., dbConnection.
  2. Use the “Execute Query” activity to run the SQL query that retrieves the list of table names. Save the output as a DataTable variable, e.g., dtTables.
    Use query:
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE';
  1. Loop through each table by using For Each row in data table activity and pass dtTables to get count of rows from each Table.
    Inside the loop, Use another “Execute Query” activity to execute the count query. Save the output as another DataTable, e.g., dtRowCount.
    SQL Query:
SELECT 'TableName' AS TableName, COUNT(*) AS RowCount FROM TableName

Append this dtRowCount to an datatable which is outside of the For Each.

That’s it. You will have row counts of all tables.

Thanks,
Ashok :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.