APIs & Integrations

charles3
Participant

ODBC SQL Associated Company ID error

SOLVE

I’m trying to update [associated company id] on contacts through SQL but having some issues.

I am using the CDATA Hubspot ODBC driver on SQL Server 17 and it works as intended.

 

When looking at the contract table, SQL is telling me that the [associated company id] is a real value, although I am not 100% sure this is true.

 

If I try to update a contact record’s [associated company id]  I get the below.


update [hstest].[HSTEST].[HubSpot].[Contacts]

set [associated company id] = 1528142503

where vid = '25601'


Msg 0, Level 16, State 1, Line 6

[500] Could not execute the specified command: Property values were not valid.

 

If I try to cast the integer to real, I get the same error

 

update [hstest].[HSTEST].[HubSpot].[Contacts]

set [associated company id] = cast(1528142503 as real)

where vid = '25601'


Msg 0, Level 16, State 1, Line 5

[500] Could not execute the specified command: Property values were not valid.

 

I know there are some restriction on the use of this field, but I’m sure it should work through the ODBC driver, has anyone encountered this?

 

Additionally, I create a ‘zap’ using Zapier to assign a value to the [associated company id] for every new contact created, just to be sure this field is updateable, and the zap works fine.

 

I’ve reached out to CDATA on the above but would be glad to hear any thoughts on this roadblock.

 

Worst case scenario, I can let Zapier do the association, but I’d like to be able do to this in SQL

0 Upvotes
1 Accepted solution
JasminLin
Solution
HubSpot Employee
HubSpot Employee

ODBC SQL Associated Company ID error

SOLVE

Hi @charles3 , to update the contact's associated company you need to do it via our API endpoint e.g. https://developers.hubspot.com/docs/methods/crm-associations/associate-objects. I'm not too sure about your SQL implementation, but as long as your implementation sends the correct request body to the correct endpoint, it should update accordingly. Using the CRM Association API I linked as an example, you need to send a PUT request to the endpoint, the article includes an example of the request body you need to send. 

View solution in original post

0 Upvotes
2 Replies 2
JasminLin
Solution
HubSpot Employee
HubSpot Employee

ODBC SQL Associated Company ID error

SOLVE

Hi @charles3 , to update the contact's associated company you need to do it via our API endpoint e.g. https://developers.hubspot.com/docs/methods/crm-associations/associate-objects. I'm not too sure about your SQL implementation, but as long as your implementation sends the correct request body to the correct endpoint, it should update accordingly. Using the CRM Association API I linked as an example, you need to send a PUT request to the endpoint, the article includes an example of the request body you need to send. 

0 Upvotes
charles3
Participant

ODBC SQL Associated Company ID error

SOLVE

This was due to an issue with the ODBC. All good now. 

0 Upvotes