SF_ReplicateIAD creates a local replicated table with the contents of the same object at Salesforce.com, including any archived or deleted records from the recycle bin. The name of the local table is the same name as the Salesforce.com object (i.e. Account). Any schema changes in the object at Salesforce.com are reflected in the new table.


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

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


The following example replicates the local Accounttable with the current data on Salesforce.com using the Salesforce linked server. Any archived or deleted records are included in the local table

 EXEC SF_ReplicateIAD 'Salesforce' , 'Account'


  • SF_ReplicateIAD creates a full copy and downloads all the data for that object from Salesforce.

  • Do not try to SF_Refresh tables created with SF_ReplicateIAD. Instead use SF_RefreshIAD.

  • SF_ReplicateIAD only retrieves the deleted records that are currently in the Salesforce recycle bin.

  • SF_ReplicateIAD retains the permanently deleted rows from run to run. Once you begin to use SF_ReplicateIAD for a table, do not use SF_Replicate on the same table. If you run SF_Replicate instead of SF_ReplicateIAD, you lose all the permanently deleted rows in the local table.


  • bulkapiSF_ReplicateIAD uses the Salesforce.com web services API by default. To use the Salesforce.com bulkAPI instead, add the optional bulkapi switch. SF_ReplicateIAD then submits a BulkAPI job and polls for completion. You should only use BulkAPI for large tables.

    For example, to use the BulkAPI and poll for completion:

    EXEC SF_ReplicateIAD 'Salesforce','Account','bulkAPI'
  • batchsizeSF_ReplicateIAD uses the maximum allowed batch size of 2000 rows. You may need to reduce the size to accommodate APEX code on the Salesforce.com server. To specify a different batch size, use the batchsize(𝘹𝘹) option after the operation.

    For example, to set the batch size to 50:

    EXEC SF_ReplicateIAD 'Salesforce','Account','batchsize(50)'
  • pkchunkSF_ReplicateIAD uses the Salesforce web services API by default. To use the Salesforce BulkAPI with the pkchunking header instead, add the optional pkchunk switch. SF_ReplicateIAD then submits a BulkAPI job using the pkchunking header and polls for completion. Only use this option for large tables.

    For example, to use pkchunk and poll for completion:

    EXEC SF_ReplicateIAD 'Salesforce','Account','pkchunk'

    The default batch size is 100,000. You can alter this using the batchsize parameter:

    EXEC SF_ReplicateIAD 'Salesforce','Account','pkchunk,batchsize(50000)'
  • NoDropSF_ReplicateIAD drops the local table by default. To use SF_ReplicateIAD without dropping the local table, add the optional NoDrop switch.

    For example, to use NoDrop with SF_Replicate:

    EXEC SF_ReplicateIAD 'Salesforce','Account','nodrop'