<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>View without a primary key</title><link>https://community.appian.com/discussions/f/data/14066/view-without-a-primary-key</link><description>Hi, 
 I am creating a view with union of two tables so this view doesn&amp;#39;t have a primary key. 
 When i create CDT , appian creates a primary key and it says that a_id does not exist with the database . 
 Do you know how to resolve this situation ? 
 
</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: View without a primary key</title><link>https://community.appian.com/thread/63741?ContentTypeID=1</link><pubDate>Tue, 01 Jan 2019 18:21:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:28bc2b85-c5eb-44a4-89a6-5be53f04d309</guid><dc:creator>vijayanv</dc:creator><description>&lt;p&gt;Use ROWNUM and define this field as a primary key in cdt.&lt;br /&gt; &lt;br /&gt; SELECT ROWNUM as ID, &amp;lt;columns&amp;gt; FROM&lt;br /&gt; (select &amp;lt;columns&amp;gt; from &amp;lt;table1&amp;gt;&lt;br /&gt; union&lt;br /&gt; select &amp;lt;coulumns&amp;gt; from &amp;lt;table1&amp;gt; );&lt;br /&gt; &lt;br /&gt; Your XSD:&lt;br /&gt; &amp;lt;xsd:element name=&amp;quot;id_int&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;xsd:annotation&amp;gt;&lt;br /&gt; &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id&amp;lt;/xsd:appinfo&amp;gt;&lt;br /&gt; &amp;lt;/xsd:annotation&amp;gt;&lt;br /&gt; &amp;lt;/xsd:element&amp;gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: View without a primary key</title><link>https://community.appian.com/thread/63740?ContentTypeID=1</link><pubDate>Tue, 01 Jan 2019 17:47:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:03816a4e-94fe-4acb-9ef0-47e6eab8535a</guid><dc:creator>Aditya GIll</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When you map a New cdt to data store without having a primary key, Appian automatically creates a new column for primary key i.e. a_id. This new column is not accessible to for use. You need to recreate a cdt for view, you can also add a manual auto-increment in the database like,&lt;br /&gt;&lt;pre class="ui-code" data-mode="sql"&gt;SELECT CAST(ROW_NUMBER() OVER(ORDER BY column_Name) AS INT) AS PRIMARY_KEY ,* FROM
( View ) A&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and map this column as primary key on CDT.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Aditya&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>