SF_RefreshIAD compares the current, local replicated table with the contents of the same object at Salesforce.com. Any inserted or updated rows are detected and the local table is updated. Use the SF_RefreshIAD stored procedure when you need to sync your local copy (created with SF_ReplicateIAD) with Salesforce.com.

SF_RefreshIAD adds to the local table all deleted rows that are currently in the recycle bin. This is an important difference between SF_RefreshIAD and SF_Refresh. SF_RefreshIAD uses the QueryAll API call.

You can only use SF_RefreshIAD on objects in Salesforce that contain the necessary timestamp columns for tracking changes.


 EXEC SF_RefreshIAD '𝘭𝘪𝘯𝘬𝘦𝘥_𝘴𝘦𝘳𝘷𝘦𝘳','object_name','SchemaError'

where linked_server is your linked server name, and object_name is the object name.

Set the optional parameter SchemaError to 'Yes' if you want SF_RefreshIAD to automatically call SF_ReplicateIAD when there is a schema change to the Salesforce object.

If SchemaError is not provided, SF_RefreshIAD throws an error if the two schemas do not match.

The optional parameter bulkapi directs SF_RefreshIAD to use the BulkAPI instead of the Salesforce web services API. Only use this option if you are having problems with SF_RefreshIAD. Using the BulkAPI is always slower but may be the only way to download rows from Salesforce.com. Normally, you should not specify this option. To use the bulkAPI, add 'bulkapi' to the list of SF_RefreshIAD parameters:

 EXEC SF_RefreshIAD 'Salesforce','Account','Yes','bulkAPI'

Refresh Example

The following example refreshes the local Accounttable with the current data on Salesforce.com using the Salesforce linked server.

 EXEC SF_RefreshIAD 'Salesforce', 'Account'


The table must contain a SystemModstamp column in order to be refreshed. A local copy of the table must exist and be less than 30 days old. If the table does not exist, use the SF_ReplicateIAD procedure to make a local copy before refreshing the table.