Our use of cookies

We use cookies to tailor your experience, gather analytics, and provide you with live assitance. By clicking "Accept" or continuing to browse our site you agree to the use of cookies. For more details please read our Cookie Policy.

Access live SharePoint data from SQL Server

In this blog, We will take an in-depth look into how SQList transforms SharePoint lists into SQL tables and how it stores data into each column. We will also look at how all changes made in SharePoint are continuously synchronized into their corresponding SQL Server tables.

Scenario

Replication of SharePoint lists data into SQL Server database and analysis of the columns created in SQL table for the respective SharePoint list columns of various types, including choice, currency, single-lookup, and multi-lookup columns.

If you would rather watch a video, this tutorial is also available on our YouTube channel at: https://youtu.be/MFXrrlZ5tAA

SharePoint Lists

For this demo, we will use three custom lists with some data in SharePoint Online.

Product list

  • This list contains all the product data.
  • Columns
    • Title (Single Line of Text)
    • Unit Price (Money)
    • Current Stock (Number)
    • Category ID (single-lookup column linked to category list).

Invoice List

  • It is a custom list that contains data of the invoices created for product orders.
  • Columns
    • Title (Single Line of Text)
    • Customer ID (lookup column linked to a Customer list).
    • Product IDs (multi-lookup column linked to Products list).
    • Total Amount (Currency)

Customer List

  • It is a picture library used to store details of all the customers.
  • Columns
    • Title (Single Line of Text)

Step-1: Create a Database in SQL Server

First off, we need a database that will be used for replicating the data coming from SharePoint lists.

Open SQL Server Management Studio and create a new database named “AxioDemoSpColumns”.

 

Step-2: Replicate and Synchronize data to Database

Secondly, we need to replicate the data from SharePoint lists into SQL Server database. We will use SQList to achieve that.

 

Open SQList Manager and click on “Create a new replication”.

 

Create a new SharePoint connection, enter the connection name and Table prefix “AxioDemoLists”

and select the SharePoint site which contains the lists and clicks next.

 

The next step is to select the replication lists, we will select the 3 lists which are going to be used for this exercise i.e. Product, Invoice and Customer.

 

Next, enter the details for the destination SQL database connection which is the database we created earlier.

 

Last step is to give this replication a name, and keep the default options as checked and then click finish.

Once the replication is created, SQList replication service will start off for synchronizing the SharePoint lists and SQL database.

Once the service is started, you will see that some tables have been created in the destination database including the tables for the lists which we selected.

Note: SQList will keep the database in-sync with the SharePoint lists which means any updates made in the lists will be replicated in this database as well.

Step-3: Comparison of SharePoint List Columns and SQL Columns

Now, let’s look at how the Sharepoint lists and columns are transformed into SQL tables and SQL columns.

First off, there is a table created for each list.

In addition to that, a table has been created for each lookup column as well which will store the ID of the parent list (Invoice) item and the value of lookup (Customer) column. For multiple-values selected, there will be multiple rows for each (Product) item selected.

To understand how the SQList creates SQL data tables for the SharePoint lists, Lets to do the comparison of Invoice and product List columns in SharePoint List and SQL table.

Below is the table to show the conversion of sharepoint list columns into sql data columns.

For each lookup column with “Allow multiple values” selected, SQList creates a separate SQL table which stores the ID of the parent list item and the lookup item ID/s creating a one to many relationships between parent and child tables. Since the Invoice list has a lookup column “Product IDs” with allow multiple values checked, a table  “AxioDemoLists_Invoices_ProductIDs” is created.

Now, let’s compare the date in SharePoint List and SQL table to see how data is replicated by SQList in the SQL table. We will also join the Products, ProductIDs and Customer tables to get the lookup values.

 

The result shows that for each invoice item, there are multiple no of rows returned based on the no of products associated to that invoice. but apart from that, the data is stored in an identical fashion.

Now to test the synchronization, let’s go to SharePoint and add a new invoice “Demo Invoice” with three products. when we run the query again, we will three new rows are returned for the new invoice item.

Conclusion

To summarize, today we saw:

  • how SQList transforms SharePoint List into a set of normalised SQL tables;
  • what types of data columns are created against each SharePoint list column;
  • how replicated data are stored in SQL tables using SQL column types that most closely match the types of thecorresponsing CharePoint columns;
  • how multi-lookup columns are stores in auto-generated relational tables that allows the many-2-many relationships between the main and lookup tables.

Latest articles

AxioWorks Newsletter August 2021: We’re working hard

30 Aug 2021

Hello Reader, Welcome to another exciting issue of our monthly Newsletter! Each month, we try our best to bring to you content that is relevant and […]
[read article]

Get the Power of Location-based analytics in Power BI using ArcGIS Maps

16 Aug 2021

In today’s world, data analytics has to become pivotal for making informed decisions and decision-makers are always keen to find new and innovative […]
[read article]

AxioWorks Newsletter July 2021: We’ve expanded!

01 Aug 2021

Hello Reader, Welcome to another exciting issue of our monthly Newsletter! Each month, we try our best to bring to you content that is relevant and […]
[read article]

SharePoint Spaces: Empowering enterprises to build Virtual Reality solutions

31 Jul 2021

The World is moving towards virtual reality which is considered by most tech gurus as one of the technologies of the future. The capabilities offered […]
[read article]

AxioWorks Newsletter July 2021: Building up a successful release in June

03 Jul 2021

Hello Reader, Welcome to another exciting issue of our monthly Newsletter! Each month, we try our best to bring to you content that is relevant and […]
[read article]

We are looking for a Sales and Marketing Manager!

18 Jun 2021

We are looking for someone with experience in the SharePoint and BI arenas to take on the role of Sales and Marketing Manager. You will be able to […]
[read article]

Mover : Only Migration tool you will ever need to move your cloud content to SharePoint

11 Jun 2021

One of the biggest conundrum of any organization planning to move to SharePoint is how to move all their documents stored in various different […]
[read article]

New version of AxioWorks SQList released (7.0.0.0)

04 Jun 2021

A new version of AxioWorks SQList is out today! We have been really busy for the past few months, but here we are with a brand new release of […]
[read article]

AxioWorks Newsletter June 2021: May has been a month of new releases

01 Jun 2021

Hello Reader, Welcome to another exciting issue of our monthly Newsletter! Each month, we try our best to bring to you content that is relevant and […]
[read article]

Form Configuration Editor: Lightweight and Built-in SharePoint List Form editor

16 May 2021

SharePoint Lists provides an easy and robust way of storing and manipulating data in SharePoint.  When you set up a new custom list, you also get OOTB […]
[read article]

Get SharePoint and SQL news to your inbox

Stay up-to-date with industry news and trends, SQL and SharePoint innovations and all the latest from AxioWorks by subscribing to our monthly newsletter.

Subscribe to the AxioWorks newsletter

*