﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Multiple Primary Key Fields</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 12:43:21 GMT</lastBuildDate><ttl>20</ttl><item><title>Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17125.aspx</link><description>I am attempting to insert a record into a table with multiple primary key fields.&amp;nbsp; The SF Business Object has the following properties set:&lt;/P&gt;&lt;P&gt;PrimaryKeyIsAutoIncremented = False&lt;BR&gt;PrimaryKeyIsUpdateable = True&lt;/P&gt;&lt;P&gt;When I run my code, the error generated tells me:&lt;/P&gt;&lt;P&gt;Cannot insert explicit value for identity column in table 'MyTable' when IDENTITY_INSERT is set to OFF.&lt;/P&gt;&lt;P&gt;Dude...wudzupwiddat?&lt;BR&gt;Bill</description><pubDate>Wed, 18 Jun 2008 09:28:52 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17144.aspx</link><description>[quote][b]Bill Cunnien (06/18/2008)[/b][hr]Hey Edhy,&lt;P&gt;Related?&amp;nbsp; Nope.&amp;nbsp; Right on!!!&amp;nbsp; That is exactly what I needed.&amp;nbsp; :w00t:&amp;nbsp; I have made the necessary adjustments to my BOs and am now testing the procedure.&amp;nbsp; So far, the results are good...very good.&amp;nbsp; Man, am I glad that I did not have to rewrite any of this in TSQL.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks!&lt;BR&gt;Bill[/quote]&lt;P&gt;Hi Bill,&lt;P&gt;I am glad that was the answer.&amp;nbsp; I was following this thread, but somehow got a bit lost with your situation, then with your last post, I saw the light :hehe:</description><pubDate>Wed, 18 Jun 2008 09:28:52 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17143.aspx</link><description>Good answer, Edhy!</description><pubDate>Wed, 18 Jun 2008 09:25:03 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17141.aspx</link><description>Hey Edhy,&lt;/P&gt;&lt;P&gt;Related?&amp;nbsp; Nope.&amp;nbsp; Right on!!!&amp;nbsp; That is exactly what I needed.&amp;nbsp; :w00t:&amp;nbsp; I have made the necessary adjustments to my BOs and am now testing the procedure.&amp;nbsp; So far, the results are good...very good.&amp;nbsp; Man, am I glad that I did not have to rewrite any of this in TSQL.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks!&lt;BR&gt;Bill</description><pubDate>Wed, 18 Jun 2008 09:13:46 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17140.aspx</link><description>Hi Bill,&lt;/P&gt;&lt;P&gt;Please check out this post: &lt;A href="http://forum.strataframe.net/Topic17032-6-1.aspx?Highlight=BOM"&gt;http://forum.strataframe.net/Topic17032-6-1.aspx?Highlight=BOM&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I believe this&amp;nbsp;may be&amp;nbsp;related to your needs.</description><pubDate>Wed, 18 Jun 2008 08:36:16 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17139.aspx</link><description>[quote]I will need to resort to a stored procedure to insert these records.[/quote]&lt;/P&gt;&lt;P&gt;Btw, I really hope not.&amp;nbsp; 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.&amp;nbsp; 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.&amp;nbsp; And, to explain this all to my manager will be even worse.&lt;/P&gt;&lt;P&gt;So, my hope is that SF can come through for me.&amp;nbsp; Can you?&lt;BR&gt;&lt;BR&gt;:unsure:&lt;BR&gt;Bill</description><pubDate>Wed, 18 Jun 2008 07:56:44 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17138.aspx</link><description>Here is what just popped out...on the first table that I am updating, there are two primary key fields.&amp;nbsp; As I mentioned, neither of these are identity columns.&amp;nbsp; As I searched through the table, I discovered that there is indeed an identity column.&amp;nbsp; It is indexed, but not part of the primary key for the table.&amp;nbsp; I know that the SF framework is quite flexible and that you guys have thought of just about everything.&amp;nbsp; Was this thought of and how do I handle it in the BO?&amp;nbsp; My thinking is that I will need to resort to a stored procedure to insert these records.&lt;/P&gt;&lt;P&gt;Thanks for all of your help!&lt;BR&gt;Bill</description><pubDate>Wed, 18 Jun 2008 07:39:13 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17137.aspx</link><description>[quote]The first thing that I would look at would be INSERT_IDENTITY[/quote]&lt;/P&gt;&lt;P&gt;Peter and Trent,&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; I actually love the BOL.&amp;nbsp; When this error came up I read the same entry that you mentioned, Peter.&amp;nbsp; It does provide decent insight into what SQL Server is doing when manipulating the identity columns manually; however, I am not really doing that.&amp;nbsp; I am inserting a record into a table that has multiple primary keys.&amp;nbsp; None of the keys are identity columns.&amp;nbsp; So, I think (I know...dangerous, at times) that this may be a setting on the BO somewhere.&amp;nbsp; I will do a little more checking, now that I had a good night's sleep.&amp;nbsp; I am sure something will pop out at me.&lt;/P&gt;&lt;P&gt;Bill</description><pubDate>Wed, 18 Jun 2008 07:15:21 GMT</pubDate><dc:creator>Bill Cunnien</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17129.aspx</link><description>[quote]Dude...wudzupwiddat?[/quote]&lt;/P&gt;&lt;P&gt;LOL....I needed a good laugh :)&amp;nbsp; I like your attitude!&amp;nbsp; I think that Pete gave you excellent advice.&amp;nbsp; Since your PK is not being auto-incremented then you will have to specify the PK value yourself (like you needed me to tell you that part&amp;nbsp;:hehe: ) if it is not being set on the SQL side (i.e. default value, trigger, etc.).&amp;nbsp; &lt;/P&gt;&lt;P&gt;The first thing that I would look at would be INSERT_IDENTITY to see if you have an issue on that side.&amp;nbsp; if you get stuck, then give me some more details and we can go to the next step ;)</description><pubDate>Tue, 17 Jun 2008 20:00:13 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Multiple Primary Key Fields</title><link>http://forum.strataframe.net/FindPost17128.aspx</link><description>Hi Bill,&lt;/P&gt;&lt;P&gt;This looks like an SQL error - check the BOL for IDENTITY_INSERT:&lt;/P&gt;&lt;P&gt;"At any time, only one table in a session can have the IDENTITY_INSERT property set to ON. If a table already has this property set to ON, and a SET IDENTITY_INSERT ON statement is issued for another table, SQL Server 2005 returns an error message that states SET IDENTITY_INSERT is already ON and reports the table it is set ON for.&lt;/P&gt;&lt;P xmlns=""&gt;If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value.&lt;/P&gt;&lt;P xmlns=""&gt;The setting of SET IDENTITY_INSERT is set at execute or run time and not at parse time."&lt;/P&gt;&lt;P xmlns=""&gt;Cheers, Peter&lt;/P&gt;&lt;P xmlns=""&gt;&amp;nbsp;</description><pubDate>Tue, 17 Jun 2008 17:07:31 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>