SQL Server is a popular Relational Database Management System (RDBMS) used by small and large businesses. It can store and retrieve data as requested by software applications.
You can ingest data from your SQL Server database using Hevo Pipelines and replicate it to a Destination of your choice.
Prerequisites
Perform the following steps to configure your SQL Server Change Tracking Source:
Enable TCP/IP Protocol (Optional)
Perform the following steps to enable TCP/IP protocol for your SQL Server instance:
1. Enable the TCP/IP port
-
Open the SQL Server Configuration Manager.
-
In the left pane, click SQL Server Network Configuration, and then double-click Protocols for <Your SQL Server Instance Name>. The default instance names are MSSQLSERVER and MSSQLSERVER01.

-
In the right pane, if the Status field of the TCP/IP Protocol Name is Disabled, then perform this step. Else, skip to the Verify the TCP/IP port section.
-
Right-click TCP/IP and select Enable.

-
Click OK to acknowledge the dialog box that warns you to restart the services for the changes to take effect.
2. Verify the TCP/IP port
Perform the following steps to check the port where TCP/IP is enabled:
-
Right-click the TCP/IP Protocol Name and select Properties.

-
In the TCP/IP Properties dialog, click the IP Addresses tab.
-
Scroll down to the IPAll section and note the TCP Port for your SQL Server instance.

-
Click OK.
3. Restart the SQL Server instance
-
In the left pane, click SQL Server Services.
-
In the right pane, right-click the SQL Server (<Your SQL Server Instance Name>) and select Restart.

You have successfully enabled TCP/IP for your SQL Server instance.
Enable Change Tracking
The Change Tracking mechanism captures changes made to a database. To enable change tracking, connect to your SQL Server database as a user with ALTER DATABASE privilege using any SQL client tool, such as sqlcmd, and enter the following commands:
Note: Replace the placeholder values in the commands below with your own. For example, <database_name> with demo.
-
Enable change tracking at the database level:
ALTER DATABASE <database_name> SET CHANGE_TRACKING = ON
(CHANGE_RETENTION = 3 DAYS, AUTO_CLEANUP = ON)
The CHANGE_RETENTION
value specifies the duration for which change tracking information is retained. You can use AUTO_CLEANUP
to enable or disable the cleanup task that removes old change tracking information. Read Enable Change Tracking for a Database.
Note: Hevo recommends that you set the CHANGE_RETENTION
value to 3 DAYS. This reduces the risk of log expiry in the case of Pipelines having a low sync frequency, for example, 24 hours.
-
Enable change tracking for each table that you want to replicate:
ALTER TABLE <schema_name>.<table_name> ENABLE CHANGE_TRACKING
Repeat this step for each table you want to replicate using Change Tracking. Read Enable Change Tracking for a Table.
Note: If the Schema Evolution Policy for your Pipeline is set to Allow all changes and a new table is created in your schema after the Pipeline creation, you need to enable change tracking for the new table. After that, refresh the schema so that Hevo can begin ingesting data from it. If change tracking is not enabled, Hevo marks the object as inaccessible and does not ingest any data from it.
Allowlist Hevo IP addresses for your region
You need to allowlist the Hevo IP addresses for your region to enable Hevo to connect to your SQL Server database. To do this:
-
Press Windows + R to open the Run dialog box.
-
Type wf.msc in the Open field and click OK.

-
In the window that appears, click Inbound Rules in the left pane, and then click New Rule in the right pane.

-
In the Rule Type dialog, select Custom and click Next.

-
In the Program dialog, select This program path, specify the path to the sqlservr.exe file, and then click Next.
Note: The sqlservr.exe file is generally found in the %ProgramFiles%\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Binn\
folder.

-
In the Protocol and Ports dialog, do the following:

-
Select TCP from the Protocol type drop-down.
-
Select Specific Ports from the Local port drop-down.
-
Specify the port on which your SQL Server listens for connections.
Note: By default, SQL Server listens for connections on port 1433.
-
Click Next.
-
In the Scope dialog, select These IP addresses and click Add.

-
In the IP Address window that appears, enter Hevo’s IP address for your region and click OK.

-
(Optional) Click Add and repeat step 8 to allowlist all the IP addresses for your region.
-
Click Next.
-
In the Action dialog, ensure that Allow the connection is selected and click Next.

-
In the Profile dialog, ensure that all the check boxes are selected and click Next.

-
In the Name dialog, specify a name for your inbound rule and click Finish.

Create a Database User and Grant Privileges
1. Create a database user (Optional)
Note: Skip to the Grant privileges to the user section if you are using an existing database user.
Perform the following steps to create a database user in your SQL Server database:
-
Connect to your SQL Server database as an admin user with any SQL client tool, such as sqlcmd.
-
Run the following commands:
# Select a database
USE <database_name>;
# Create a login and a database user
CREATE LOGIN <login_username> WITH PASSWORD = '<password>';
CREATE USER <database_username> FOR LOGIN <login_username>;
Note: Replace the placeholder values in the commands above with your own. For example, <login_username> with hevouser.
2. Grant privileges to the user
The database user for Hevo requires the following privileges to connect to and ingest data from your SQL Server database:
Privilege |
Grants access to |
SELECT |
Retrieve rows from the database tables. |
VIEW CHANGE TRACKING |
View changes made to tables or schemas for which with the Change Tracking feature is enabled. |
Connect to your SQL Server database as an admin user with any SQL client tool, such as sqlcmd, and run the following script:
# Grant SELECT privilege at the database level
GRANT SELECT ON DATABASE::<database_name> TO <database_username>;
# Grant SELECT privilege at the schema level
GRANT SELECT ON SCHEMA::<schema_name> TO <database_username>;
# Grant VIEW CHANGE TRACKING privilege at the schema level
GRANT VIEW CHANGE TRACKING ON SCHEMA::<schema_name> TO <database_username>;
# Grant VIEW CHANGE TRACKING privilege at the table level
GRANT VIEW CHANGE TRACKING ON OBJECT::<schema_name>.<table_name> TO <database_username>;
Note: Replace the placeholder values in the commands above with your own. For example, <database_username> with hevo.
Perform the following steps to configure your SQL Server Change Tracking Source:
-
Click PIPELINES in the Navigation Bar.
-
Click + CREATE PIPELINE in the Pipelines List View.
-
On the Select Source Type page, under All Sources, click Edge, and then select SQL Server Change Tracking.

-
In the SQL Server Change Tracking screen, specify the following:

-
Source Name: A unique name for your Source, not exceeding 255 characters. For example, SQL Server Change Tracking.
-
In the Connect to your SQL Server section:
-
Database Host: The SQL Server host’s IP address or DNS. For example, 10.123.10.001.
-
Database Port: The port on which your SQL Server listens for connections. Default value: 1433. This can be the port number that you obtained in Step 1 above.
-
Database User: The authenticated user who has the permissions to read tables in your database. This user can be the login user you created in Step 4 above. For example, hevouser.
-
Database Password: The password for your database user.
-
Database Name: The database from where you want to replicate data. For example, demo.
-
Schema Name: The schema that holds the tables to be replicated. Default value: dbo.
-
In the Additional Settings section:
-
Use SSH: Enable this option to connect to Hevo using an SSH tunnel instead of directly connecting your SQL Server database host to Hevo. This provides an additional level of security to your database by not exposing your SQL Server setup to the public.
If this option is turned off, you must configure your Source to accept connections from Hevo’s IP address.
-
Use SSL: Enable this option to use an SSL-encrypted connection. Specify the following:
-
CA File: The file containing the SSL server certificate authority (CA).
-
Client Certificate: The client’s public key certificate file.
-
Client Key: The client’s private key file.
-
Click TEST & CONTINUE to test the connection to your SQL Server Change Tracking Source. Once the test is successful, you can proceed to set up your Destination.
Read the detailed Hevo documentation for the following related topics:
Data Type Mapping
Hevo maps the SQL Server Source data type internally to a unified data type, referred to as the Hevo Data Type, in the table below. This data type is used to represent the Source data from all supported data types in a lossless manner.
The following table lists the supported SQL Server data types and the corresponding Hevo data type to which they are mapped:
SQL Server Data Type |
Hevo Data Type |
- CHAR - VARCHAR - TEXT - NCHAR - NVARCHAR - NTEXT - XML - UNIQUEIDENTIFIER - GEOMETRY - GEOGRAPHY - HIERARCHYID - SQL_VARIANT |
VARCHAR |
- DATETIMEOFFSET |
TIMESTAMPTZ |
- DATETIME - SMALLDATETIME - DATETIME2 |
TIMESTAMP |
- TIME |
TIME |
- TINYINT - SMALLINT |
SHORT |
- BIGINT |
LONG |
- INT |
INTEGER |
- REAL |
FLOAT |
- FLOAT |
DOUBLE |
- NUMERIC - DECIMAL - MONEY - SMALLMONEY |
DECIMAL |
- DATE |
DATE |
- BINARY - VARBINARY - IMAGE - TIMESTAMP |
BYTEARRAY |
- BIT |
BOOLEAN |
At this time, the following SQL Server data types are not supported by Hevo:
Note: If any of the Source objects contain data types that are not supported by Hevo, they are marked as unsupported during object configuration in the Pipeline.
Source Considerations
- When a record is updated multiple times between two consecutive data ingestion runs, Change Tracking provides only the latest update made to the record. As a result, Hevo ingests only the latest record at the time of ingestion, which can lead to the loss of any updates that occurred between the previous ingestion and the current one.
Limitations
-
Hevo does not support data replication from temporary tables and views.
-
Hevo does not set the metadata column __hevo__marked_deleted to True for data deleted from the Source table using the TRUNCATE command. This action could result in a data mismatch between the Source and Destination tables.