Skip to main content

SLAM_record_counts

Overview

Retrieves record counts for all Salesforce objects and stores them in the provided table name. These counts may not be real-time accurate as they are processed and cached by Salesforce on a schedule.

Parameters

NameTypeDefaultDescription
@tableVARCHARRequiredTarget SQL table name for results
@exists_actionVARCHAR(20)NULLControls the behavior when the destination table name, specified by @table is already used. If NULL, uses the value from SLAM_Settings.default_exists_action (defaulted to 'drop' during initial setup).

Valid options:

  • 'drop' - Drop the existing object and create a new one (default)
  • 'rename' - Rename the existing object by appending a timestamp suffix (format: _YYYYMMDDTHHMMSS_MMM)
  • 'fail' - Throws a SQL exception if the destination object already exists

Usage Examples

EXEC dbo.SLAM_record_counts @table = 'Object_Record_Counts';

SELECT * FROM Object_Record_Counts;

With explicit exists action:

EXEC dbo.SLAM_record_counts
@table = 'Object_Record_Counts',
@exists_action = 'rename';