Knowledgebase
What is wrong with this query to update TimeTracking table using Linked Server on SQL 2005?
Posted by brad waddell on 12 March 2009 05:21 PM

Author Message Rajib Bahar Group: Members Posts: 8 Joined: 2008-01-08 Profile Posted:2008-02-08 09:42:20

I have set up a linked server called QUICKBOOKS_DATA. What is wrong with the query below? The error is complaining about a field that is not allowed in an insert. I do not know which field is/are disallowed during insertion. Thanks in advance for the help.

-------------------
INSERT INTO QUICKBOOKS_DATA...TimeTracking (TxnID, TimeCreated, TimeModified,
TxnNumber, TxnDate, TxnDateMacro, EntityRefListID, EntityRefFullName, CustomerRefListID,
CustomerRefFullName, ItemServiceRefListID, ItemServiceRefFullName, DurationMinutes,
ClassRefListID, ClassRefFullName, BillableStatus )
SELECT '0000000', getdate(), getdate(),
'12345', '2/2/2008', getdate(), '80000182-1197387266', 'Rajib Bahar', '80000172-1195590502',
'Proj00:Proj03', '8000006E-1197387831', 'Employee Consulting:Rajib Bahar', 600,
'30000-1148588106', 'Minneapolis:MSP - Consultant', 'Billable'
--------

Rajib Bahar
http://www.rajib-bahar.com
http://www.icsql.com
http://www.youtube.com/icsql
Tom 6c3c1_sdk-qodbc.gif Group:Administrator Posts:5510 Joined:2006-02-17 Profile Posted:2008-02-08 10:07:02

First of all, not all columns in any QODBC table are insertable. Several columns are automatically maintained by QuickBooks and are READ-ONLY. For the schema rules for any QODBC table, do:

sp_columns Tablename

There's also formatting required for dates.

Please see:
How are dates formatted in SQL queries when using the QuickBooks generated time stamps?
How do I do INSERTs, UPDATEs and DELETEs using OPENQUERY with Linked MS SQL Servers?
How do I insert data into the Timetracking table?
for more information.


Rajib Bahar Group: Members Posts: 8 Joined: 2008-01-08 Profile Posted:2008-02-08 10:17:25

Thanks. This post helped me resolve the issue.
Rajib Bahar
http://www.rajib-bahar.com
http://www.icsql.com
http://www.youtube.com/icsql

post_id 2170 forum522c.html Link to Original Article

(10 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please complete the captcha below (we use this to prevent automated submissions).