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

Can we create a foreign key constraint in Hana?

$
0
0

Do you by any chance know how to create a foreign key constraint on a table in Hana?

From what I read,
http://help.sap.com/hana/html/sql_alter_table.html

I should be allowed to do the below but keep getting a syntax error?

ALTER TABLE USER_LOGIN_AUDIT ADD CONSTRAINT FK FOREIGN KEY (USER_KEY) REFERENCES USER_ACCOUNT(USER_KEY) ON DELETE CASCADE;

or

CREATE TABLE USER_LOGIN_AUDIT
(
   USER_LOGIN_AUDIT_KEY Int NOT NULL,
   USER_KEY Int NOT NULL,
   LOGIN_TIME TIMESTAMP,
   PRIMARY KEY (USER_LOGIN_AUDIT_KEY),
   FOREIGN KEY (USER_KEY) REFERENCES USER_ACCOUNT
); 

But again the following thread speaks about it not existing.

http://scn.sap.com/thread/3147395

 

Please advice.

 

Thanks,

Geetha


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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