<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : How to do Identity Insert with the PM.</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : How to do Identity Insert with the PM.</description>
  <pubDate>Thu, 11 Jun 2026 09:20:01 -700</pubDate>
  <lastBuildDate>Sun, 27 Jan 2008 12:01:38 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=664</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>How to do Identity Insert with the PM. : Hi David. Thank you for the response.  The...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2468#2468</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=234" rel="nofollow">Quigrim</a><br /><strong>Subject:</strong> 664<br /><strong>Posted:</strong> 27-Jan-2008 at 12:01pm<br /><br /><div><font face="Arial" size="2">Hi David. Thank you for the response.</font></div><div>&nbsp;</div><div><font face="Arial" size="2">The reason for this is that I have a legacy system and DB and have another copy of that DB running the same Entity Model.</font></div><div><font face="Arial" size="2">DB 1 allocates those ID's with it's identity column, but I need to populate those same specific ID's into DB2's identity column.</font></div><div><font face="Arial" size="2">The catch comes in that I'm running the same model against both DB's. I could have run a different model against DB2 and removed that columns identity specification on DB2, but for various other reasons we decided on the same model for both DBs.</font></div><div>&nbsp;</div><div><font face="Arial" size="2">Before I got your reply, I just implemented a passthrough query that uses standard SQL to insert into that table after having turned on IDENTITY_INSERT. This works, and due to deadlines on the project it'll have to stay like that for now, but I'd like to come up with a more elegant solution to this problem some time.</font></div><div>&nbsp;</div><div><font face="Arial" size="2">Jacques</font></div>]]>
   </description>
   <pubDate>Sun, 27 Jan 2008 12:01:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2468#2468</guid>
  </item> 
  <item>
   <title>How to do Identity Insert with the PM. : I am not quite sure why you have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2458#2458</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 664<br /><strong>Posted:</strong> 25-Jan-2008 at 1:16pm<br /><br /><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I am not quite sure why you have this requirement.&nbsp; It might help if I knew this.&nbsp; Do you have a requirement that you be able to insert very specific values, or do you simply need to guarantee that the number you insert on the client is not going to be changed by the database?&nbsp; If it is the latter, DevForce already guarantees this behavior.<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">This is what DevForce Help says:<o:p></o:p></SPAN></FONT></P><H3><A name=_Toc185153164></A><A name=_Toc177907555></A><A name=_Toc175052513></A><A name=_Toc174789380></A><A name=IdentityIdGenerati&#111;n></A><B><FONT face="Times New Roman" color=navy size=4><SPAN style="FONT-SIZE: 13.5pt; COLOR: navy">Sql Server Identity Id Generation<o:p></o:p></SPAN></FONT></B></H3><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">The default DevForce processing for SQL Server tables with an identity column uses two SQL Server features which require that the connected user have elevated privileges:<o:p></o:p></SPAN></FONT></P><P =bulletlist><FONT face=Symbol color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy; FONT-FAMILY: Symbol">·</SPAN></FONT><FONT color=navy size=1><SPAN style="FONT-SIZE: 7pt; COLOR: navy">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN =ce><FONT color=navy size=1><SPAN style="FONT-SIZE: 9pt; COLOR: navy">DBCC CHECKIDENT</SPAN></FONT></SPAN><FONT color=navy><SPAN style="COLOR: navy">, so we can re-set the curren seed for the next identity value.<o:p></o:p></SPAN></FONT></P><P =bulletlist><FONT face=Symbol color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy; FONT-FAMILY: Symbol">·</SPAN></FONT><FONT color=navy size=1><SPAN style="FONT-SIZE: 7pt; COLOR: navy">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN =ce><FONT color=navy size=1><SPAN style="FONT-SIZE: 9pt; COLOR: navy">SET IDENTITY_INSERT</SPAN></FONT></SPAN><FONT color=navy><SPAN style="COLOR: navy">, so we can specify the Identity column value on insert.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">When DevForce issues those commands, it must be logged in either as the owner of the tables or as a member of the sysadmin, db_owner or db_ddladmin roles.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">This shouldn’t be an issue in an n-tier deployment where the DevForce process issuing these commands is running in a secure environment on a host machine.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">Two-tier (“Client/Server”) applications may be ok too, especially if they execute on a secure LAN and the connection string specifies Windows authentication.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">Some applications don’t fit these criteria. They are two-tier and n-tier, for some reason, is not a current option. Perhaps they can’t use Windows authentication and must specify a username and password in the connection string. No one wants connection credentials with administrator rights floating about.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy">Perhaps the application can switch from Identity Ids to a table-drive custom id design. That won’t be an option if there are legacy applications referencing the same data.</P><DIV></SPAN></FONT><FONT face="Times New Roman" color=navy size=3><SPAN style="FONT-SIZE: 12pt; COLOR: navy"><BR><B><SPAN style="FONT-WEIGHT: bold">&nbsp;Related Topics</SPAN></B><BR><SPAN =relatedtopics><a href="mk:@MSITStore:C:\Program%20Files\IdeaBlade%20DevForce\&#068;ocumentati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_408.htm" target="_blank"><FONT title=mk:@MSITStore:C:\Program%20s\IdeaBlade%20DevForce\ati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_408.htm color=navy><SPAN title=mk:@MSITStore:C:\Program%20s\IdeaBlade%20DevForce\ati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_408.htm style="COLOR: navy">Advanced Object Persistence Concepts</SPAN></FONT></A> </SPAN><BR><SPAN =relatedtopics><a href="mk:@MSITStore:C:\Program%20Files\IdeaBlade%20DevForce\&#068;ocumentati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_450.htm" target="_blank"><FONT title=mk:@MSITStore:C:\Program%20s\IdeaBlade%20DevForce\ati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_450.htm color=navy><SPAN title=mk:@MSITStore:C:\Program%20s\IdeaBlade%20DevForce\ati&#111;n\IdeaBlade%20DevForce%20C&#111;nsolidated%20Help.chm::/2/_450.htm style="COLOR: navy">Identity Id Generation Via Stored Procedure</SPAN></FONT></A></SPAN></SPAN></FONT><SPAN =relatedtopics> </SPAN><o:p></o:p></DIV><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Note that our SqlServerIdentityIdGenerator doesn’t allow you to use a “specific” value, just the “next” one. &nbsp;You can implement a custom IIdentityIdGenerator and possibly accomplish the “specific” value part.&nbsp; But when the generator is called to map temp to real it only knows about temp ids, you’d have to use the EntityColumn in the temp id to get to the Entity. &nbsp;The mapping also is done for all records to be inserted – if user wanted it done one-by-one they’d have to do a ForceIdFixup. &nbsp;So, I’d say potentially doable with a custom implementation, depending on user’s requirements.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">If the IIdentityIdGenerator doesn’t work, then RPC might work, or anything where they’d use the AdoHelper to directly work with the connection and command objects.<o:p></o:p></SPAN></FONT></P><P =Ms&#111;normal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>]]>
   </description>
   <pubDate>Fri, 25 Jan 2008 13:16:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2458#2458</guid>
  </item> 
  <item>
   <title>How to do Identity Insert with the PM. : On SQL Server you can insert a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2456#2456</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=234" rel="nofollow">Quigrim</a><br /><strong>Subject:</strong> 664<br /><strong>Posted:</strong> 25-Jan-2008 at 12:04am<br /><br />On SQL Server you can insert a specific value into an identity column by just running the following statement first:<br>SET IDENTITY_INSERT &lt;tablename&gt; ON<br><br>I need to do the same thing adding an entity with DevForce.<br>I haven't been able to find out any information on how to do this.<br>Would greatly appreciate some assistance on this?<br><br>Thanx much.<br>Jacques<br>]]>
   </description>
   <pubDate>Fri, 25 Jan 2008 00:04:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=664&amp;PID=2456#2456</guid>
  </item> 
 </channel>
</rss>