SLAM_query
This command provides generalized query support with the API provided as a @api query parameter. @batch_size is only relevant to SOAP API and @pkchunksize is only relevant to Bulk v1 API.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
@query | NVARCHAR | Required | sObject name or SOQL query string. When just an sObject name is passed, queries all records & fields |
@table | VARCHAR | Required | Target SQL table name for results |
@api | NVARCHAR | Required | API to use ('bulk', 'bulkv2', or 'soap') |
@pkchunksize | INT | NULL | Enable PK chunking (Bulk v1 API only). If NULL, PK chunking is disabled |
@batch_size | INT | 2000 | Number of records per batch (SOAP API only) |
@queryall | BIT | 0 | When 1, includes deleted/archived records |
@exists_action | VARCHAR(20) | SLAM_Settings.default_exists_action | Action to take if the target object name specified by @table is already taken. If NULL, uses the value from SLAM_Settings.default_exists_action (defaulted to 'drop' during initial setup).Valid options:
|
Usage Examples:
Query using Bulk API with PK Chunking:
EXEC dbo.SLAM_query
@query = 'Account',
@table = 'Account_query',
@api = 'bulk',
@pkchunksize = 100000
Query using SOAP API with custom batch size:
EXEC dbo.SLAM_query
@query = 'SELECT Id, Name, Email, Account.Name FROM Contact WHERE CreatedDate = TODAY',
@table = 'Contact_query',
@api = 'soap',
@batch_size = 1500
Query using Bulk v2 API for large datasets:
EXEC dbo.SLAM_query
@query = 'SELECT * FROM Opportunity WHERE CreatedDate > LAST_N_DAYS:365',
@table = 'Opportunity_query',
@api = 'bulkv2'