I am looking for a way to synchronize Salesforce data with a local database. At the moment I just want a pain free way of downloading the data. I've been playing around with importing CSVs from the data loader and direct database inserts using Jitterbit. This all works fine (as fine as CSVs can be!) but it is very tedious work to create tables without any strict data type/constraint definitions for classes with many fields. Is there a way to find this information so that I can create the tables with more confidence? Or better yet a tool or some APEX that will output a create table script based on the actual Salesforce class fields?

The destination database is SQL Server 2008.

  • 1
    If you are going to go very far with this (and have funds and believe in make vs buy tradeoffs) then there are 3rd party products already written that do this (and more) well and pretty much in a fully automated way. Can you confirm that spending such money is not an option?
    – Keith C
    Mar 20, 2014 at 15:30
  • Unfortunately I am unable to spend any money on software to do this. I was hoping that there might be some sort of free tool available or maybe some apex code.
    – JonM
    Mar 20, 2014 at 15:32
  • 1
    Maybe you can give a try for the Talend Mar 20, 2014 at 15:39
  • @JonM Fair enough. As you probably know the APIs are there, but it would be good to get a head start with the code.
    – Keith C
    Mar 20, 2014 at 15:42
  • 3
    I once made an application for a company that would build a SQL Server schema using the Salesforce meta data and then load the DataExport CSVs into it. I'll see if I can find a reference to it. Mar 23, 2014 at 7:42

1 Answer 1


I have to do this a lot and thought it was crazy I needed an ETL tool for something conceptually so simple. I ended up using Salesforce Dev Tools (free Chrome extension) to get the schema out of Salesforce into Excel for one or many objects.

Then there is a second step where I concatenate each object correctly and then I copy the contents of the column to have properly formatted SQL.

Little bit of Excel wrangling the first time, but after that, its simple and repeatable with minimum effort. Frankly, I have to do it so much that I am gong to code something up as you suggest not in APEX but using the REST API and a little PHP.

I have been training my team how to do this I created some scribe recordings with step by step: Get the Salesforce schema to Excel: https://scribehow.com/shared/Use_Dev_Tools_Chrome_Extension_to_Export_ERD_and_Fields_to_Excel___ZdMcC6XSmeXv08SJQyKSw

Here is a google sheet with the Excel portion that uses the stnadard Salesforce Developer instance schema https://docs.google.com/spreadsheets/d/1rGvFzT6FITzSFUO9zqXt_VqIvenDDVgB/edit?usp=sharing&ouid=103779483934757758766&rtpof=true&sd=true

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .