<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 'ApplyEdits' with one 'adds' fail when SQL server table have a FOREIGN KEY in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32665#M142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the integer value that I use in my request is a valid value that satisfy normal TSQL insert scripts when the FK is applied.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Jan 2015 12:19:50 GMT</pubDate>
    <dc:creator>GertConradie</dc:creator>
    <dc:date>2015-01-07T12:19:50Z</dc:date>
    <item>
      <title>'ApplyEdits' with one 'adds' fail when SQL server table have a FOREIGN KEY</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32664#M141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a REST (FeatureServer) service that I make an 'ApplyEdits' call to. It only succeeds if I remove an existing FK constraint on one of my columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the FK is applied, the service request fail and supply a code &lt;SPAN style="color: #008080; font-family: Consolas; font-size: 10pt;"&gt;1060&lt;/SPAN&gt; and a "&lt;SPAN style="color: #008080; font-family: Consolas; font-size: 10pt;"&gt;Rowbuffer creation failed.&lt;/SPAN&gt;" error. (In the logs available in the ArcGIS server administrator it becomes more clear what the internal SQL error was.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a work-around for that? Would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Full scripts for my SQL tables attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Small snippet below:&lt;/P&gt;&lt;P&gt;========================&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-family: Consolas; font-size: 10pt;"&gt;--=====================================&lt;BR /&gt;-- Unless this FK constraint is removed, an ESRI Feature Service 'ApplyEdits' with the following 'adds' fail:&lt;BR /&gt;-- [{"geometry":{"x":97655.99152462519,"y":367271.9541849444,"spatialReference":{"wkid":29903,"latestWkid":29903}},"attributes":{"Label":"blablabla","SpecificFeatureTypeId":2,"PlanId":1}}]&lt;BR /&gt;--=====================================&lt;BR /&gt;ALTER TABLE [dbo].[PlanSpecificFeatures]&amp;nbsp; WITH CHECK ADD&amp;nbsp; CONSTRAINT [FK_PlanSpecificFeatures_SpecificFeatureType] FOREIGN KEY([SpecificFeatureTypeId])&lt;BR /&gt;REFERENCES [dbo].[SpecificFeatureType] ([SpecificFeatureTypeId])&lt;BR /&gt;GO&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-family: Consolas; font-size: 10pt;"&gt;ALTER TABLE [dbo].[PlanSpecificFeatures] CHECK CONSTRAINT [FK_PlanSpecificFeatures_SpecificFeatureType]&lt;BR /&gt;GO&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 12:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32664#M141</guid>
      <dc:creator>GertConradie</dc:creator>
      <dc:date>2015-01-07T12:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: 'ApplyEdits' with one 'adds' fail when SQL server table have a FOREIGN KEY</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32665#M142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the integer value that I use in my request is a valid value that satisfy normal TSQL insert scripts when the FK is applied.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2015 12:19:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32665#M142</guid>
      <dc:creator>GertConradie</dc:creator>
      <dc:date>2015-01-07T12:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'ApplyEdits' with one 'adds' fail when SQL server table have a FOREIGN KEY</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32666#M143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the fix/workaround:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to set the identity seed value of the 'master' table that you have a relationship with to start with '0' instead of the default '1'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume ArcGIS first create a record with the default int/string values and then update the attributes afterwards. (Might be problematic on a database with lots of integrity checks applied...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt;CREATE TABLE [dbo].[SpecificFeatureType](&lt;BR /&gt; [SpecificFeatureTypeId] [int] &lt;STRONG&gt;IDENTITY(0,1)&lt;/STRONG&gt; NOT NULL,&lt;BR /&gt; [Name] [varchar](50) NOT NULL,&lt;BR /&gt; CONSTRAINT [PK_SpecificFeatureType] PRIMARY KEY CLUSTERED &lt;BR /&gt;(&lt;BR /&gt; [SpecificFeatureTypeId] ASC&lt;BR /&gt;)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]&lt;BR /&gt;) ON [PRIMARY]&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 09:55:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/applyedits-with-one-adds-fail-when-sql-server/m-p/32666#M143</guid>
      <dc:creator>GertConradie</dc:creator>
      <dc:date>2015-01-12T09:55:46Z</dc:date>
    </item>
  </channel>
</rss>

