[CLOSED] WF Maintain -- INCLUDE-ing Records Into a Table That Auto-Generates Keys
I'm working with a guy that's trying to insert records via a Maintain form into a view that auto-generates its key values. The key is an integer. When he attempts to perform the include with no value in the key field, he gets
(FOC1400) SQLCODE IS 544 (HEX: 00000220) XOPEN: 23000 : Microsoft SQL Native Client: [23000] Cannot insert explicit value for id : entity column in table 'staff' when IDENTITY_INSERT is set to OFF. (FOC1740) EXECUTE ERROR : VSTAFFADD
He'd like to utilize the db's auto-key-generator feature. Is this possible, and if it is, what's the secret?
J.This message has been edited. Last edited by: Kerry,
March 17, 2010, 12:58 PM
EWoerle
John,
Can you include the code for the maintain? It will help a lot in working with you to debug your issue.
Thanks
Eric Woerle WF 7.6.7 Reportting Server ETL 7.6.10 Dev Studio 7.6.7
March 17, 2010, 01:06 PM
John_Edwards
.
Not a lot of complexity to the Maintain code --
for all Include VSTAFFADD.VSTAFFADD.EMPLOYED VSTAFFADD.VSTAFFADD.LAST_NAME VSTAFFADD.VSTAFFADD.GIVEN_NAME VSTAFFADD.VSTAFFADD.INITIALS VSTAFFADD.VSTAFFADD.FULL_NAME VSTAFFADD.VSTAFFADD.MAIL VSTAFFADD.VSTAFFADD.USERNAME VSTAFFADD.VSTAFFADD.TELEPHONE VSTAFFADD.VSTAFFADD.TITLE from addStaffStk;
Note that the key value is not included in this version, but he's tried both. Add VSTAFFADD.VSTAFFADD.EMP_KEY at the top and you're there.
My guess is that the Stack is assuming a key value of 0 and sending it. We adjusted the master file to allow the key to be missing=on and then computed a missing value in it explicitly prior to the INCLUDE but that made no difference.
J.
.
March 17, 2010, 01:21 PM
John_Edwards
.
Update -- magic, it's running.
On examining the master file, setting the key field to FIELDTYPE=R seems to suppress the sending of the key value entirely.
We're not exactly sure how things changed to make it work, but we're not going the belabor the point.