Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Please implement the following FOREIGN KEY and PRIMARY KEY syntax simplifications...

   INDEX index-name 
   | [ INDEX ] FOREIGN KEY role-name 
   ON [ owner.]object-name
   } the FROM clause index hints WITH and FORCE INDEX:

FROM  table-expression, ...

table-expression :
   | ...

table-name :
   [ WITH ( hint [...] ) ]
   [ FORCE INDEX ( index-name ) ]

hint :
   table-hint | index-hint

index-hint : 
   | INDEX ( [ PRIMARY KEY | FOREIGN KEY ] index-name [, ...] ) [ INDEX ONLY { ON | OFF } ]

Currently, you have to remember/look up/figure out what the primary and foreign key index names... hint: they are NOT the same as the CONSTRAINT names.

asked 09 Oct '10, 15:29

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

Just to clarify (I had to read this several times - possibly due to a "lack of coffee"...): You are suggesting a simplification for the FROM CLAUSE (i.e. to allow to specify a PK without an index name and a FK with its role-name instead of an index-name), and you are taking the simplified syntax from the VALIDATE INDEX statement, right?

(11 Oct '10, 07:22) Volker Barth

Exactly. (and now I have to keep typing to make the comment long enough)

(11 Oct '10, 13:41) Breck Carter

Once understood, I second that proposal:)

(11 Oct '10, 14:28) Volker Barth

Until now I wasn't aware that the PRIMARY KEY and FOREIGN KEY syntax that was added for hints required the specification of the index name as well. I would agree that we could make this simpler. We'll look at doing exactly that.

permanent link

answered 11 Oct '10, 15:33

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 09 Oct '10, 15:29

question was seen: 8,644 times

last updated: 11 Oct '10, 15:33