Connie Jerdet-Skehan
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,'sele ct ToBeEmailed from invoice where customerreffullname = database.dbo.dbtable.email edcustomer id) 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,'sele ct * 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,'sele ct 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.
My Query:
Update openquery(QUICKBOOKS,'sele
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,'sele
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,'sele
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.
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.
Sorry I did type it wrong here the column is "IsToBeEmailed" but the queries did have it set right.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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.
did you get "ToBeEmailed " from
Select * from openquery(QUICKBOOKS,'sele
?
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