> For the complete documentation index, see [llms.txt](https://howto.erpbridge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://howto.erpbridge.io/readme/companies/synchronization-from-hubspot-to-erp/advices-and-best-practices.md).

# Advices and Best Practices

Now that the data is regularly synchronized on ERP Bridge Database, you can see them in a SQL summary table with all data.

<figure><img src="/files/StKT2Jrq8ECCEjGXImZP" alt=""><figcaption><p>Data from HubSpot on the SQL table</p></figcaption></figure>

You find below an example of stored procedure that you can use for your daily synchronization:

```sql
USE [ERPBridge]
GO
/****** Object:  StoredProcedure [dbo].[StoredProcedureName] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[StoredProcedureName] 
AS

BEGIN
	SET NOCOUNT ON;

	DECLARE @CodiceERP varchar(max)
	DECLARE @CompanyName varchar(max)
	DECLARE @StreetAddress varchar(max)
	DECLARE @VAT varchar(max)


	DECLARE cursor_companies CURSOR FOR
    
	select distinct
		ERPCode
		,CompanyName
		,StreetAddress
		,VAT

	from
		ERPBridge.dbo.T_Companies

	where
		LastModifiedDate>GETDATE()-1


	OPEN cursor_companies

	FETCH NEXT FROM cursor_companies INTO @ERPCode, @CompanyName, @StreetAddress, @VAT

	WHILE @@FETCH_STATUS=0
	BEGIN
		IF(@ERPCode IS NULL OR @ERPCode = '')
		BEGIN
			UPDATE NameTable_ERP SET CompanyName_ERP=@CompanyName, StreetAddress_ERP=@StreetAddress, VAT_ERP=@VAT WHERE ERPCode_ERP=@ERPCode	
		END
		ELSE
		BEGIN
			INSERT INTO NameTable_ERP(ERP_Code, CompanyName_ERP, StreetAddress_ERP, VAT_ERP VALUES (@ERPCode, @CompanyName, @StreetAddress, @VAT)
		END

		FETCH NEXT FROM cursor_companies INTO @ERPCode, @CompanyName, @StreetAddress, @VAT
	END

	CLOSE cursor_companies
	DEALLOCATE cursor_companies
END

```
