Connect SQL Server to Salesforce: 3 Easy Methods

on CRMs, Data Integration, Microsoft SQL Server, Salesforce, SQL Server • June 10th, 2022 • Write for Hevo

Connect sql server to salesforce: FI

Salesforce, the World’s No. 1 CRM Solution, has seen impressive growth for years, attributable to its remarkable offering of Salesforce Products such as Salesforce Sales Cloud, Service Cloud, Marketing Cloud, Experience Cloud, Analytics Cloud, and many more which have made Salesforce earn a sterling reputation.

Microsoft SQL Server is a relational database management system. The purpose of the system is to manage and store information. Various business intelligence, analytics, and transaction processing operations are supported by the system.

This article discusses the different methods to Connect SQL Server to Salesforce extensively. In addition to that, it also describes SQL Server and Salesforce briefly.

Table Of Contents

What is SQL Server?

connect sql server to salesforce: microsoft sql server logo
Image Source

Developed in 1989, SQL Server is a Relational Database Management System (RDBMS) developed by Microsoft. SQL Server is based on SQL, a widely-used programming language for working with relational databases. SQL Server has been available on Linux since 2016, but it has previously only been available on Windows operating systems.

The SQL Server consists of a core component called a Database Engine. This Database engine consists of a relational engine to process queries and a storage engine to manage databases, files, pages, indexes, and more. Database objects such as stored procedures, views, and triggers are also executed by the Database engine.

Salesforce gives customers, employees, and partners of a company a highly customized experience. Customize standard functionality and create custom pages, components, apps, and more using a platform like this. It is also completed more quickly, owing to the outstanding architecture upon which it is based.

Replicate Data in Minutes Using Hevo’s No-Code Data Pipeline

Hevo Data, a Fully-managed Data Pipeline platform, can help you automate, simplify & enrich your data replication process in a few clicks. With Hevo’s wide variety of connectors and blazing-fast Data Pipelines, you can extract & load data from 100+ Data Sources including SQL Server and Salesforce straight into your Data Warehouse or any Databases. To further streamline and prepare your data for analysis, you can process and enrich raw granular data using Hevo’s robust & built-in Transformation Layer without writing a single line of code!

GET STARTED WITH HEVO FOR FREE

Hevo is the fastest, easiest, and most reliable data replication platform that will save your engineering bandwidth and time multifold. Try our 14-day full access free trial today to experience an entirely automated hassle-free Data Replication!

Key Features of SQL Server

  • Analytics Support: Organizations seek insights into stored and managed data to make better decisions. With Microsoft SQL, you can analyze your stored data using integration with Microsoft SQL Server Analysis (SSAS) which is an online analytical processing tool.
  • Multiple Integrations: SQL enables users to perform various tasks like Data Extraction, Transformation, Data Migration, Data Loading, and more on their stored data using Microsoft SQL Server Integration Services (SSIS).
  • High Performance: SQL Server is a database programming language that allows you to build highly transactional databases. With SQL queries, you can describe your data analytically. 
  • High Availability: SQL Server is compatible with MySQL, Oracle database, Microsoft Access, IBM DB2, and more.  
  • High Security: Tables, views, stored procedures, and other SQL Server objects can all have permissions assigned to them.

What is Salesforce?

connect sql server to salesforce: salesforce logo
Image Source

Salesforce is a cloud-based software company that offers sales, customer service, marketing automation, analytics, and application development CRM software and applications.

Salesforce is a well-known cloud-based CRM (Customer Relationship Management) platform. It has over 800 apps to help with things like generating new leads, acquiring new leads, increasing sales, and closing deals. Its purpose is to keep track of the company’s data of customers and sales. It also has options for customizing its data structures and graphical user interface to meet a company’s specific requirements. It has recently begun to connect the CRM platform to the IoT (Internet of Things).

Key Features of Salesforce

  • Contact Management: To see information about customers, such as contact information, activity history, customer communications, and internal account discussions, among other things. In a nutshell, it keeps track of all customer data.
  • Opportunity Management: It contains information about the stage of a deal, the products involved in the deal, and the deal’s quotation, among other things. In a nutshell, it keeps track of all the information needed to identify, progress, and close a deal.
  • Sales Performance Management: It provides the sales team with metric-based goal setting, as well as continuous feedback, rewards, and recognition. This aids the sales team’s performance.
  • Lead Management: This feature starts and tracks the leads that are currently active. It also aids in the continuous optimization of campaigns across all channels.
  • Partner Management: This feature aids in the formation of a community among partners. It also facilitates direct communication with channel partners to share goals, objectives, and activities.
  • Territory Management: This feature is used to create multiple territory models, preview them before rollout, and optimize and balance territories throughout the year.

Ways to Connect SQL Server to Salesforce

Connect SQL Server to Salesforce: Import and Export

  • SQL Server comes with a plethora of native and third-party tools, including, of course, tools for importing data from other sources. Start with SQL Server Import and Export Wizards, which are standard SQL Server and Salesforce Tools for importing data to connect SQL Server to Salesforce.
  • By default, the SQL Server Import Wizard allows you to import data from other SQL Server databases, Oracle, Flat Files, such as CSV, and Access Data Source, PostgreSQL, MySQL, or Azure Blob Storage. Importing data directly from Salesforce, on the other hand, necessitates the use of a third-party ADO.NET provider or an ODBC driver.
  • The SQL Server Import Wizard can also be used to export Salesforce Data to CSV and then import it into SQL Server. Salesforce native tools for exporting Salesforce data to CSV files are available in the cloud, such as Dataloader.io, and locally, such as the Data Loader tool. Salesforce allows you to download the latter directly. It’s in the Platform Tools section of Setup.
  • Follow the steps below to Connect SQL Server to Salesforce by Import and Export Wizards:
    • Step 1: Select Data Loader from the Data Management menu.
connect sql server to salesforce: through linked server data loader
Image Source
  • Step 2: You must first download and install the appropriate version of Data Loader, then log into Salesforce and export data from the necessary objects. 
  • Step 3: Next, you can import them into SQL Server tables with the SQL Server Import Wizard. Please keep in mind that this method of data integration is one-way only. It is not possible to migrate data backwards.
connect sql server to salesforce: through import export wizard choose data source
Image Source

What Makes Hevo’s ETL Process Best-In-Class

Providing a high-quality ETL solution can be a difficult task if you have a large volume of data. Hevo’s automated, No-code platform empowers you with everything you need to have for a smooth data replication experience.

Check out what makes Hevo amazing:

  • Fully Managed: Hevo requires no management and maintenance as it is a fully automated platform.
  • Data Transformation: Hevo provides a simple interface to perfect, modify, and enrich the data you want to transfer.
  • Faster Insight Generation: Hevo offers near real-time data replication so you have access to real-time insight generation and faster decision making. 
  • Schema Management: Hevo can automatically detect the schema of the incoming data and map it to the destination schema.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources (with 40+ free sources) such as SQL Server and Salesforce that can help you scale your data infrastructure as required.
  • Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
Sign up here for a 14-day free trial!

Connect SQL Server to Salesforce: With a Linked Server

Set up a linked server for Salesforce Data using the SQL Gateway and the ODBC Driver.

You can use the SQL Gateway to set up a linked server for Salesforce Data and configure a TDS (SQL Server) remoting service. To create the linked server, use the UI in SQL Server Management Studio or call stored procedures after the service has been started. After that, you can work with Salesforce Data as if it were a linked SQL Server instance to connect SQL Server to Salesforce. Follow the steps given below to connect SQL Server to Salesforce through a Linked Server:

Step 1: Connect to Salesforce as an ODBC Data Source

  • If you haven’t already done so, create an ODBC DSN with Connection Properties (data source name). The driver installation process comes to a close with this step. You can create and configure ODBC DSNs with the Microsoft ODBC Data Source Administrator.
  • To connect SQL Server to Salesforce, you can use one of three authentication methods: login, OAuth, or SSO. You’ll need the user’s Username, Password, and Security Token to use the Login method.
  • You can use OAuth Authentication if you don’t have access to the Username and Password or don’t want to require them.
  • Setting the SSOProperties, SSOLoginUrl, and TokenUrl connection properties allows you to authenticate to an Identity Provider, allowing you to use SSO (single sign-on).

Step 2: Configure the TDS Remoting Service

TDS Remoting Service is a Daemon process that monitors Client TDS Requests.

Follow the steps below to set up remoting services to proxy MySQL and SQL Server commands to an ODBC Driver after installing the SQL Gateway on the machine where your DSN is installed:

Step 2.1 Creating Remoting Services

Because the SQL Gateway connects to ODBC Drivers via System DSNs, you’ll need Administrator Access to create new remoting services. Below are the steps for creating a new service.

  • Step 1: Select the Run as a Windows Service Box on the Status tab if you want the services to run as Windows Services.
  • Step 2: Select the Services tab, then Add and give the service a Name.
connect sql server to salesforce: through linked server creating remoting services new service automatic
Image Source
  • Step 3: Choose SQL Server or MySQL as your database type.
  • Step 4: In the Data Source menu, pick a system DSN to connect to. Specify Authentication and other values in a DSN by consulting the help documentation for your data source.
  • Step 5: Allow SSL to be used to secure Client Connections. On the Other tab, you’ll also have to set up a Digital Certificate.
  • Step 6: Select the Service’s Local Port. If you want to connect across the firewall using reverse SSH tunneling, select “Expose on Gateway.”
  • Step 7: Select a Startup option and any logging options.
connect sql server to salesforce: through linked server creating remoting services new service manual
Image Source
Step 2.3 Creating Users

To create and configure a new user, go to the Users tab and click Add. Permissions should be applied to each service that is created. Alternatively, choose the Administrator option to give the user full access to all services.

connect sql server to salesforce: through linked server creating users
Image Source
Step 2.4 Connecting Through an SSH Tunnel

If you want to connect to the SQL Gateway using reverse SSH tunneling, go to the SSH Tunnel tab and configure the SQL Gateway to connect to your hosted SSH Server.

connect sql server to salesforce: through linked server connecting through an ssh tunnel
Image Source

Once the services are up and running, you can use MySQL or TDS remoting to connect to your ODBC Data Sources. Simply point your tool or application to the server that is running the app (or the SSH server if you are using the Gateway).

Step 3: Create a Linked Server for Salesforce Data

Create the Linked Server and connect SQL Server to Salesforce after you’ve configured and started the daemon. You can use SQL Server Management Studio’s user interface or call Stored Procedures.

Step 3.1: Create a Linked Server from the UI

Create a Linked Server using the Object Explorer by following the steps below.

  • Step 1: Connect to a SQL Server Instance using SQL Server Management Studio.
  • Step 2: Expand the SQL Server Database node in the Object Explorer. Right-click Linked Servers in the Server Objects node and select New Linked Server. The dialogue for creating a New Linked Server appears.
  • Step 3: After naming the linked server, click the Other Data Source option in the General section and enter the following information.
    • Provider: Choose the SQL Server Native Client Provider that matches your SQL Server version. SQL Server Native Client 11.0, for example.
    • Data Source: Separate the host and port where the TDS remoting service is running with a comma. Note that a value of “localhost” in this input refers to the machine on which SQL Server is running, so be cautious when creating a linked server in Management Studio if you are not running SQL Server on the same machine.
    • Catalog: CData Salesforce Sys is the DSN for the CData system.
connect sql server to salesforce: through linked server create linked server
Image Source
  • Step 4: Select the option to “make the connection using this security context” in the Security section, and then enter the Username and Password for a user you created in the SQL Gateway’s Users tab.
connect sql server to salesforce: through linked server linked server properties
Image Source
Step 3.2: Create a Linked Server Programmatically

You can use stored procedures in addition to the SQL Server Management Studio UI to create a linked server. The following data must be provided:

  • server: The name of the linked server.
  • provider: For the SQL Server Native Client Provider, type “SQLNCLI.”
  • datasrc: A comma separates the host and port on which the service is running.

When creating a linked server in Management Studio, keep in mind that a value of “localhost” in the datasrc input refers to the machine where SQL Server is running, so be careful when not running on the same machine as SQL Server.

  • catalog: Enter the service’s system DSN.
  • srvproduct: Enter the Data Source’s Product name; this can be anything from “CData SQL Gateway” to an empty string.

To create the linked server and configure SQL Gateway Authentication, follow the steps below:

  • Step 1: To create a linked server, use the sp addlinkedserver command:
EXEC sp_addlinkedserver @server='Salesforce',
@provider='SQLNCLI',
@datasrc='< MachineIPAddress >,1434',
@catalog='CData Salesforce Sys',
@srvproduct='';
GO
  • Step 2: To allow SQL Server users to connect with the credentials of an authorized user of the service, use the sp addlinkedsrvlogin stored procedure. It’s worth noting that the credentials you use to connect to the service must refer to a user you created on the SQL Gateway’s Users tab.
EXEC sp_addlinkedsrvlogin @rmtsrvname='Salesforce',
@rmtuser='admin',
@rmtpassword='test',
@useself='FALSE',
@locallogin=NULL;
GO

Step 4: Connect from SQL Server Management Studio

  • SQL Server Management Studio makes use of the SQL Server Client OLE DB provider, which necessitates the in-process use of the ODBC Driver
  • To query the linked server from SQL Server Management Studio, you must enable the “Allow inprocess” option in the SQL Server Native Client Provider in Management Studio. 
  • To do so, go to Server Objects -> Linked Servers -> Providers and open the properties for the provider you’re using. Save the changes after checking the “Allow inprocess” option.
Step 4.1 Execute Queries

Any tool that can connect SQL Server to Salesforce now can run queries on the Salesforce Linked Server. Assign the following table name:

SELECT * FROM [linked server name].[CData Salesforce Sys].[Salesforce].[Account]
connect sql server to salesforce: through linked server execute queries
Image Source

Connect SQL Server to Salesforce: Through SSIS

Using SQL Server as a backup for critical business data is a must-have safeguard against data loss. Furthermore, backing up data to SQL Server makes it easier for business users to connect SQL Server to Salesforce that data to features like reporting, full-text search, analytics, and more.

This example shows how to use the CData ADO.NET Data Provider for Salesforce to transfer data directly from Salesforce to a Microsoft SQL Server database using a SQL Server SSIS workflow. The procedure outlined below can be used to connect SQL Server to Salesforce directly to remote data via SSIS with any CData ADO.NET Data Provider. Follow the steps given below to connect SQL Server to Salesforce through SSIS:

  • Step 1: Make a new Integration Services Project in Visual Studio.
  • Step 2: In the Control Flow screen, drag a New Data Flow Task from the Toolbox.
  • Step 3: Add an OLE DB Destination and an ADO.NET Source from the Toolbox to the Data Flow screen.
connect sql server to salesforce: through ssis Add an OLE DB Destination and an ADO.NET Source
Image Source
  • Step 4: Select the CData Provider for Salesforce when creating a New Data Connection.
  • Step 5: Fill in your Salesforce Account’s Connection information. For this example, you’re going to use a Salesforce Developer Account. User, Password, and Access Token are all required Connection Properties. Also supported is OAuth.
connect sql server to salesforce: through ssis fill in salesforce account connection manager
Image Source
  • Step 6: Set the following information in the ADO.NET Source Editor:
    • Connection Manager: Select the Data Connection you just created from the Connection Managers menu.
    • Data Access Mode: Select ‘SQL command’ from the drop-down menu.
    • SQL Command Text: Open the Component Properties tab in the ADO.NET Source editor and type a SELECT command like this:
SELECT * FROM Account
connect sql server to salesforce: through ssis configure properties from Ado.net provider
Image Source
  • Step 7: Close the ADO.NET Source editor and connect the ADO.NET Source to the OLE DB Destination by dragging the arrow below it.
  • Step 8: In the Destination Component Editor, open the OLE DB Destination and enter the following information.
    • Connection Manager: Create a new link. Here’s where you’ll enter the details for your server and database. SQLExpress is running on a separate machine in this example.
    • Data Access Mode: Select the table or view to populate in your database and change the data access mode to “table or view.”
  • Step 9: On the Mappings screen, you can adjust any properties you want.
connect sql server to salesforce: through ssis configure properties using an OLE DB Provider
Image Source
  • Step 10: Run the project after closing the OLE DB Destination Editor. Your database will be populated with data obtained from Salesforce once the SSIS Task has been completed.

Conclusion

This article explains how to Connect SQL Server to Salesforce using various methods. It also gives an overview of Salesforce and SQL Server.

visit our website to explore hevo

Hevo Data, a No-code Data Pipeline provides you with a consistent and reliable solution to manage data transfer between a variety of sources and a wide variety of Desired Destinations, with a few clicks. Hevo Data with its strong integration with 100+ sources (including 40+ free sources) including SQL Server and Salesforce allows you to not only export data from your desired data sources & load it to the destination of your choice, but also transform & enrich your data to make it analysis-ready so that you can focus on your key business needs and perform insightful analysis.

Want to take Hevo for a spin? 

Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

No-code Data Pipeline for your Data Warehouse