Link to home
Create AccountLog in
Avatar of Connie Jerdet-Skehan
Connie Jerdet-SkehanFlag for United States of America

asked on

Update query for Quickbooks from SQL using QODBC

I am trying to run an update query from SQL Server 2008 to update a table in QuickBooks Enterprise 12 that is setup as a linked server using QODBC.
My Query:

Update openquery(QUICKBOOKS,'select ToBeEmailed from invoice where customerreffullname = database.dbo.dbtable.emailedcustomerid) set ToBeEmailed = '1'

Every month manually selecting tobeemailed for each invoice waste several days. I would like to setup a stored procedure that sets this from a table that has the list of customers that need to be emailed. I have also tried a simple query removing the table link to update just a single customer and it does not work.
Running the following returns one record with the customer I entered:

select * from openquery(QUICKBOOKS,'select * from invoice where txndate ={d''2013-06-01''} and customerreffullname = ''Customer Name''')

But running an update for even the single customer does not work, I have also tried putting the update query within the openquery.


update openquery(QUICKBOOKS,'select ToBeEmailed from invoice where txndate ={d''2013-06-01''} and customerreffullname = ''Customer Name''') set ToBeEmailed = '1'

This returns the following error:
OLE DB provider "MSDASQL" for linked server "QUICKBOOKS" returned message "[QODBC] Column not found: ToBeEmailed"

How can I get this to not only update but use the customerid from another SQL table in my database?
Any help is much appreciated, thanks.
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

it could be just typo ..

did you get "ToBeEmailed " from


Select * from  openquery(QUICKBOOKS,'select ToBeEmailed from invoice where txndate ={d''2013-06-01''} and customerreffullname = ''Customer Name''')
?


check some workarounds
http://archive.qodbc.com/forum032a.html

and check
QB linked server setup

http://support.flexquarters.com/esupport/index.php?/Default/Knowledgebase/Article/View/2350/52/how-to-create-link-server-with-ms-sql-20052008
Avatar of Connie Jerdet-Skehan

ASKER

Yes, like I said doing the select statement does return 1 record and it was the one I was wanting it to (the customer name).

Sorry I did type it wrong here the column is "IsToBeEmailed" but the queries did have it set right.
ASKER CERTIFIED SOLUTION
Avatar of Connie Jerdet-Skehan
Connie Jerdet-Skehan
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
After 2 weeks only comment was a question on if the original statement worked even though I stated that it did work in the original question, I was able to solve it before anyone was able to give me a solution.