Tom
Tom

Reputation: 4662

Quote field name and table name in Advantage database SQL

I am working on a legacy system developed with Advantage Database 8.1, I need to run SQL, like:

"SELECT CODETEST.DESC FROM CODETEST"

This SQL won't run at .NET due to the "CODETEST.DESC" name which is belong to SQL reserved keyword "DESC", I think to quote the "CODETEST.DESC", for example, in MySQL, we can use 'CODETEST'.'DESC' (I changed ` to ' here) to avoid that.

I read Advantage Database Help but can't find how to do so, it's a legacy system, and the database structure won't be changed. So is there any way to quote the table and field name in Advantage SQL?

Upvotes: 1

Views: 761

Answers (1)

Tom
Tom

Reputation: 4662

Found the answer, here Use of Non-Standard Characters in Names, its simple by [CODETEST].[DESC]

Double quotes and [] (brackets) are used to delimit identifiers that contain non-alphanumeric characters or that start with numbers. For example, if a database contains a table name or column name that starts with a number, contains spaces, or that has non-alphanumeric characters, the application must enclose the name in double quotes or [] (brackets) (e.g., "3D", "Contact Date", "l/c", [Full Name]). Also, full path names or table names that include extensions must be enclosed in double quotes or [] (brackets) (e.g., "x:\pathname\table", "\server\volume\path\table", "table.abc", "..\otherdir\table").

Upvotes: 2

Related Questions