Multiple Primary Key Fields


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I am attempting to insert a record into a table with multiple primary key fields.  The SF Business Object has the following properties set:

PrimaryKeyIsAutoIncremented = False
PrimaryKeyIsUpdateable = True

When I run my code, the error generated tells me:

Cannot insert explicit value for identity column in table 'MyTable' when IDENTITY_INSERT is set to OFF.

Dude...wudzupwiddat?
Bill

Replies
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
The first thing that I would look at would be INSERT_IDENTITY

Peter and Trent,

Thanks.  I actually love the BOL.  When this error came up I read the same entry that you mentioned, Peter.  It does provide decent insight into what SQL Server is doing when manipulating the identity columns manually; however, I am not really doing that.  I am inserting a record into a table that has multiple primary keys.  None of the keys are identity columns.  So, I think (I know...dangerous, at times) that this may be a setting on the BO somewhere.  I will do a little more checking, now that I had a good night's sleep.  I am sure something will pop out at me.

Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Here is what just popped out...on the first table that I am updating, there are two primary key fields.  As I mentioned, neither of these are identity columns.  As I searched through the table, I discovered that there is indeed an identity column.  It is indexed, but not part of the primary key for the table.  I know that the SF framework is quite flexible and that you guys have thought of just about everything.  Was this thought of and how do I handle it in the BO?  My thinking is that I will need to resort to a stored procedure to insert these records.

Thanks for all of your help!
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I will need to resort to a stored procedure to insert these records.

Btw, I really hope not.  This is a really complex procedure and I have about 400 lines of code invested with several new business objects handling all of the heavy lifting.  To relocate all of this logic (much of it is business logic and fits perfectly into the business object environment) to a stored procedure will be a nightmare.  And, to explain this all to my manager will be even worse.

So, my hope is that SF can come through for me.  Can you?

Unsure
Bill

Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Bill,

Please check out this post: http://forum.strataframe.net/Topic17032-6-1.aspx?Highlight=BOM

I believe this may be related to your needs.

Edhy Rijo

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Hey Edhy,

Related?  Nope.  Right on!!!  That is exactly what I needed.  w00t  I have made the necessary adjustments to my BOs and am now testing the procedure.  So far, the results are good...very good.  Man, am I glad that I did not have to rewrite any of this in TSQL. 

Thanks!
Bill

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Good answer, Edhy!
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Bill Cunnien (06/18/2008)
Hey Edhy,

Related?  Nope.  Right on!!!  That is exactly what I needed.  w00t  I have made the necessary adjustments to my BOs and am now testing the procedure.  So far, the results are good...very good.  Man, am I glad that I did not have to rewrite any of this in TSQL. 

Thanks!
Bill

Hi Bill,

I am glad that was the answer.  I was following this thread, but somehow got a bit lost with your situation, then with your last post, I saw the light Hehe

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 17 Years Ago
Peter Jones - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Bill Cunnien - 17 Years Ago
Bill Cunnien - 17 Years Ago
                         [quote]I will need to resort to a stored procedure to insert these...
Bill Cunnien - 17 Years Ago
                             Hi Bill, Please check out this post:...
Edhy Rijo - 17 Years Ago
                                 Hey Edhy, Related? Nope. Right on!!! That is exactly what I needed....
Bill Cunnien - 17 Years Ago
                                     Good answer, Edhy!
Trent L. Taylor - 17 Years Ago
                                     [quote][b]Bill Cunnien (06/18/2008)[/b][hr]Hey Edhy, Related? Nope....
Edhy Rijo - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search