Micrsosoft Office 365: How to Connect SQL To SharePoint lists?

When you use SharePoint Online and Microsoft 365 you can keep your data close to you with your own SharePoint on-premises installation. You can use both systems and connect them. 

 

Integrating specifically external SQL data sources (e.g. from SQL Server, Oracle, DB2, Informix, MySQL) with SharePoint lists (e.g. news, contacts, tasks or custom lists) in Microsoft Office 365, SharePoint Online or SharePoint on-premises can close many gaps. It's not only about displaying external SQL data - it's about full integration with views, search, lookups, forms, change notifications, and workflows.

 

With Layer2 Cloud Connector you can connect on-premise and cloud-based data sources to your SharePoint lists and libraries in minutes. No programming, no network adjustments, no need to change the connected systems or your data. ODBC, OLEDB, OData, Microsoft.NET based providers, file content (Excel, XML, CSV), file shares, SQL databases like SQL Server, Oracle, MySQL, IBM DB2, IBM AS/400, IBM Informix, Notes, systems like SharePoint, Exchange, Active Directory, Navision, SAP, PowerShell and more sources are supported. If you haven't tested our tool yet, you can start your free trial now.

Step by step instruction to connect SQL to SharePoint lists

This detailed instruction gives a step-by-step example with Microsoft SQL Server. Learn how to connext SQL to SharePoint lists. It works in the same way for any other database

Sample of SQL table that you can connect with a native SharePoint list

Step 1 - prepare your external SQL data source to integrate with Office 365

Let's take a sample SQL table, the well-known Northwind product catalog in SQL Server. Please note:

 

  •  You can use existing tables or views, or create direct queries in the Layer2 Cloud Connector.
  • The table should have a primary key defined, one or more unique fields. If not, you can create, e.g. using a GUID or counter (depending on features of your database system).
  • You can even make use of SQL procedures (e.g. for aggregation or to include business logic), but take care of that they return a record set (similar to a normal SQL query).

Step 2 - setup your SQL to SharePoint connection

​With Layer2 Cloud Connector Connection Manager (a MMC snap-in) you have to setup the connection (e.g. uni-directional or bi-directional, scheduling etc.), data source (your SQL database) and data destination (in SharePoint on-premise, SharePoint Online or Office 365. The list must be created manually before).

 

You can use auto mapping to connect the fields of both data entities by name or map fields manually. Please note:

 

  • Bi-directional connections require appropriate access rights on database. Use uni-directional connections if you want to push SQL data only to the cloud.
  • Please enable scheduling later, when all settings are verified and you have an idea of replication duration. Duration time depends on bandwidth, performance of source and destination, and number of fields and records in SQL. Only changes are transferred later on.
Learn how to connect sql to office 365
Enter the connection string to sync SQL with SharePoint

Before running the connection, you have to define the data source and destination. Please note:

 

  • Select the SQL Provider that fits to your database. If it's not in list, it must be installed. Take care about 64-Bit and 32-Bit. The Cloud Connector can run in both modes, but it can connect only to those providers, that fits.
  • Enter a valid connection string for your database system. See www.connectionstrings.com to know.
  • The provider offers the possibility to enter direct queries, depending on database system. Select as few fields as required to increase performance.
  • For most systems you can use aliases in field names to fit to your SharePoint Online list, e.g. Select Productname as Title from products.
  • Use the data preview to check out the result of your query.
  • For most systems a "primary key" is set automatically. 
  • Please verify all settings before save.

Next you have to define your data destination. Please note:

 

  • Use the Layer2 SharePoint CSOM Provider to connect to SharePoint on-premise, SharePoint Online or Office 365.
  • You have to create the destination list manually with all columns required to host your query data.
  • Please note that you can connect to any other type of data destination, e.g. to other SQL databases.
  • There is no need to enter a primary key, the provider automatically uses the SharePoint item ID.
Define your data destination. In our example it is a list named "Products" in our Office 365 cloud
In our example you see the column mapping of data source and data destination.

Now you have to setup the column / field mapping. You can use the auto-mapping feature (by field / column names) or map manually. Please note: 

 

  • The mapping of ProductName to Title, as SharePoint required a Title field.
  • In this case we have included the SourceID to have a clear reference to the original record.
    That is not a requirement, but advised as best practice.
  • Please note the difference in data types. The Layer2 Cloud Connector tries to match as close as possible.

 

If all settings are verified, please go to connection root and run the connection manually first. Please note, that it could take some time to transfer all nodes. You can take a look in your cloud list to see how it goes on. 

Please note: 

 

  • Changed items are transferred with the next scheduled update. That means, you can setup change notifications per-email or workflows in the cloud without any restrictions.
  • You can add additional "SharePoint only" data, e.g. attachments or managed metadata. It will be kept while items are updated (via primary key).
  • You can use Dynamic Columns in C# for data cleanup, calculation, translation or transformation. A great option to add your own business logic directly to the sync. You can also add business logic in SQL (by using procedures), or in SharePoint (by using workflows)
  • You can do anything you can generally do with a native SharePoint list - without any restrictions (e.g. search, Office / Outlook integration, Flow).
  • Don't forget to setup the scheduled background update, to keep data current in connection settings, e.g. with scheduled updates every hour or daily.
You can manage your data from SQL in SharePoint. Your data destination in Microsoft SharePoint 2013, Office 365 will look like our example.

Advantages of connecting data from SQL to SharePoint lists

 

  • The SQL Server database is a safe platform where you can store data.
  • Synchronizing your SQL Server data to SharePoint lists allows you to maintain a unified view of information across different systems. This can be valuable when SharePoint is used as a collaboration platform, and SQL Server stores transactional or business data.
  • By syncing data from SQL Server to SharePoint lists, you make this data easily accessible within the SharePoint environment, enhancing collaboration and visibility.
  • If you synchronize your SQL data to SharePoint Online lists, users can access the data from everywhere, making it beneficial for scenarios where field workers can not always connect to the internal network.
  • A main advantage of SharePoint lists is that they provide a user-friendly interface that is often more accessible to non-technical users. Synchronizing SQL Server data to SharePoint lists can make it easier for users to interact with and update data.
  • SharePoint includes robust search capabilities. Synchronizing your SQL Server data to SharePoint lists can improve search and discovery within the SharePoint environment.
  • SharePoint integrates well with Power BI, Microsoft's business analytics service. By connecting your SQL data with SharePoint lists, you can create rich reports and dashboards based on the synchronized SharePoint lists data.
  • If necessary you can export data from a list and import it into other applications. Or you set up another connection - for example to Microsoft Dynamics CRM.
  • Layer2 Cloud Connector supports you in connecting data on your  SQL Server and your SharePoint lists. This allows you to save time, avoid complex steps and prevent errors.

Start your free trial and connect SQL to SharePoint

With Layer2 Cloud Connector you can integrate and synchronize SQL data to SharePoint lists. If you haven't already installed it you can start your free trial now and experience how easy it can be to connect SQL and SharePoint.

 

TRY FOR FREE

Frequently asked questions about sync SQL data to SharePoint

Here you will find the answers to the most frequently asked questions about  connect and sync data between SQL and SHarePoint. 

 

How do I transfer data from SQL to SharePoint? 

Transferring data from SQL to SharePoint can be accomplished through various methods, depending on your specific requirements.

 

SSIS (SQL Server Integration Services):

Utilize SQL Server Integration Services to create data integration packages that move data from SQL Server to SharePoint. Schedule these packages as SQL Server Agent Jobs.

 

Power Automate (formerly Microsoft Flow):

Create a flow in Power Automate to automate the transfer of data between SQL Server and SharePoint. Use triggers, conditions, and actions to define the workflow.

 

Layer2 Cloud Connector:

For a seamless and automated data transfer experience, you may explore solutions like the Layer2 Cloud Connector. It provides an easy-to-use interface, flexible scheduling options, and bi-directional sync capabilities.

 

Custom Development:

For complex scenarios, consider custom development using .NET or PowerShell scripts to fetch data from SQL and update SharePoint lists.

 

Choose the method that best aligns with your technical expertise, business requirements, and preferred tools.


Does SharePoint support SQL?

Yes, SharePoint supports integration with SQL Server, offering seamless collaboration between these two powerful Microsoft technologies. Here's how SharePoint and SQL can work together:

 

Power Platform Integration:

Leverage the Power Platform components, including Power BI, Power Apps, and Power Automate, to integrate and automate processes between SharePoint and SQL Server.

 

Layer2 Cloud Connector:

For advanced data synchronization and integration scenarios, consider solutions like the Layer2 Cloud Connector. It enables bi-directional synchronization between SharePoint and SQL, among others offering ETL functionality to transform/manipulate data during the sync process.

 

How do I backup my SQL database to SharePoint? 

It's important to note that SharePoint is not designed to serve as a backup solution for SQL databases. While data synchronization tools, like the Layer2 Cloud Connector, enable the movement of data between SQL and SharePoint, this process doesn't replace the need for a dedicated SQL backup strategy.

 

Here are some best Practices:

SQL Database Backup:

Utilize SQL Server's built-in backup functionality or dedicated backup tools designed for SQL databases. Regularly back up your SQL database to ensure data integrity and the ability to recover in case of data loss or system failures.

 

SharePoint Data Synchronization:

If you require data visibility in SharePoint for reporting or collaboration purposes, consider using data synchronization tools like the Layer2 Cloud Connector cautiously. However, these tools should not be considered as a substitute for a robust SQL database backup strategy.

 

SharePoint Versioning:

SharePoint does offer versioning capabilities, but it's important to understand that this is not a true backup. SharePoint versioning primarily tracks changes to documents within the SharePoint environment, and it doesn't provide a comprehensive backup and restore mechanism for your SQL database.

 

Recommendation:

For SQL databases, rely on established backup methods that suit your organization's needs. Consult with your database administrator or IT department to implement a robust backup strategy using dedicated SQL Server backup tools.

If you're seeking ways to synchronize data between SQL and SharePoint for collaboration or reporting purposes, tools like the Layer2 Cloud Connector can be explored. However, always prioritize a dedicated SQL backup solution to ensure data safety and recoverability.