Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

foreign key referring to same table is not supported..

$
0
0

Hi Everyone,

 

Trying to create a foreign key referring to the primary key of same table. But prompted with, feature not supported: cannot create foreign key constraint referring to the same table.

Is it possible to create this link by any other means...

 

Please go through below syntax:

CREATE COLUMN TABLE "NEO_xxxxx"."C_EMPLOYEES" ("EMPLOYEENUMBER" INTEGER CS_INT NOT NULL ,

  "LASTNAME" NVARCHAR(50) NOT NULL ,

    "REPORTSTO" NVARCHAR(50)  NULL ,

  PRIMARY KEY ("EMPLOYEENUMBER"));

 

ALTER TABLE "NEO_xxxx"."C_EMPLOYEES" ADD CONSTRAINT "EMPLOYEES_FK2" FOREIGN KEY (REPORTSTO) REFERENCES "NEO_xxxx"."C_EMPLOYEES" (EMPLOYEENUMBER) ON UPDATE RESTRICT ON DELETE CASCADE 

Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>