SAP CAP Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 
qmacro
Developer Advocate
Developer Advocate
1,411

As in most contexts, there are some name restrictions in the underlying database systems, with regards to unusual or special characters, or reserved words. When you use names like this in your CDS models they are escaped when they're converted to the equivalent DDL, and in all queries sent to the database.

The names are escaped in the DDL by enclosing them in double quotes. Here's an example:

CREATE TABLE BadNames (
  "a name" NVARCHAR(255),
  "drôle"  NVARCHAR(255),
  "select" NVARCHAR(255),
  "group"  NVARCHAR(255)
);

While it's not good practice to define element names like this, CDS allows for such definitions.

Take the first element in this DDL definition: "a name". To express this name, which contains whitespace, in the CDS model, it would also need to be escaped. Not using double quotes as above, but using the CDS model convention.

In other words, here's what the CDS model source might have started out looking like:

entity BadNames {
  SOMETHING : String;
}

But what would have needed to appear in place of the SOMETHING here?

This is a question from the June Developer Challenge on CAP Knowledge. And don't forget: always submit your answer as a hash, on its own - read the Taking part section of the intro post for more info. At the end of today, this question will be updated with links to further reading on this topic.

Further info:

31 Comments