# 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

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://howto.erpbridge.io/readme/companies/synchronization-from-hubspot-to-erp/advices-and-best-practices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
