<?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 SQL CHECK constraint in column table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-check-constraint-in-column-table/m-p/654261#M28175</link>
    <description>&lt;P&gt;I'm trying to create a table with an identity column and a check constraint. This SQL creates the table successfully:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CREATE COLUMN TABLE TEST (
    ID		INT 	PRIMARY KEY GENERATED ALWAYS AS IDENTITY, 
    GENDER VARCHAR(1),
    CHECK (GENDER IN ('F','M'))
);
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;However when I try to insert a record using:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;INSERT INTO TEST VALUES ('F');&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I get the following error:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;12:02:48 PM (SQL Editor) Could not execute 'INSERT INTO TEST VALUES ('F')'Error: (dberror) 7 - feature not supported: [new expression] Only comparison condition for DML update is supported&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The CHECK constraint works if I don't make it a column oriented table however if I try to create an identity column without the COLUMN directive, I get this error:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;12:06:00 PM (SQL Editor) Could not execute 'CREATE TABLE TEST ( ID	INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, GENDER VARCHAR(1), ...'Error: (dberror) 7 - feature not supported: cannot create row table having identity column: ID: line 3 col 4 (at pos 25)&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Is it possible to have an identity column and a check constraint?&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Ross&lt;/P&gt;</description>
    <pubDate>Fri, 16 Feb 2018 18:08:43 GMT</pubDate>
    <dc:creator>rhightower13</dc:creator>
    <dc:date>2018-02-16T18:08:43Z</dc:date>
    <item>
      <title>SQL CHECK constraint in column table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-check-constraint-in-column-table/m-p/654261#M28175</link>
      <description>&lt;P&gt;I'm trying to create a table with an identity column and a check constraint. This SQL creates the table successfully:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CREATE COLUMN TABLE TEST (
    ID		INT 	PRIMARY KEY GENERATED ALWAYS AS IDENTITY, 
    GENDER VARCHAR(1),
    CHECK (GENDER IN ('F','M'))
);
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;However when I try to insert a record using:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;INSERT INTO TEST VALUES ('F');&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I get the following error:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;12:02:48 PM (SQL Editor) Could not execute 'INSERT INTO TEST VALUES ('F')'Error: (dberror) 7 - feature not supported: [new expression] Only comparison condition for DML update is supported&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The CHECK constraint works if I don't make it a column oriented table however if I try to create an identity column without the COLUMN directive, I get this error:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;12:06:00 PM (SQL Editor) Could not execute 'CREATE TABLE TEST ( ID	INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, GENDER VARCHAR(1), ...'Error: (dberror) 7 - feature not supported: cannot create row table having identity column: ID: line 3 col 4 (at pos 25)&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Is it possible to have an identity column and a check constraint?&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Ross&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 18:08:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-check-constraint-in-column-table/m-p/654261#M28175</guid>
      <dc:creator>rhightower13</dc:creator>
      <dc:date>2018-02-16T18:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: SQL CHECK constraint in column table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-check-constraint-in-column-table/m-p/654262#M28176</link>
      <description>&lt;P&gt;I tried changing the check to a comparison like this:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;CREATE COLUMN TABLE TEST (
    testID		INT 	PRIMARY KEY GENERATED ALWAYS AS IDENTITY, 
    GENDER VARCHAR(1),
    CHECK (GENDER = 'F' OR GENDER = 'M')
);
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But that produces this error:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;12:25:50 PM (SQL Editor) Could not execute 'DROP TABLE TEST'Error: (dberror) 259 - invalid table name: TEST: line 1 col 11 (at pos 11)
12:25:50 PM (SQL Editor) Could not execute 'CREATE COLUMN TABLE TEST ( testID	INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, GENDER ...'Error: (dberror) 288 - cannot use duplicate table name: TEST: line 2 col 20 (at pos 20)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Feb 2018 18:28:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-check-constraint-in-column-table/m-p/654262#M28176</guid>
      <dc:creator>rhightower13</dc:creator>
      <dc:date>2018-02-16T18:28:06Z</dc:date>
    </item>
  </channel>
</rss>

