0

I have a script in ASP Classic that uses a Firebird database. I would like to execute a query without "quotation marks"

Now I must write this:

SQL = "SELECT ""TArticoli"".""IDArticolo"",""TArticoli"".""Desc"" FROM ""TArticoli"";"

I would write this:

SQL = "SELECT TArticles.IDArticle, TArticles.Desc FROM TArticles;"

The first one is accepted the second not, how can I do this?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

1

You can't. DESC is a reserved word in Firebird, so to be able to use it as a column name (or any other object name for that matter), you will need to enclose it in quotes.

A second problem is that you are currently using

SELECT "TArticoli"."IDArticolo","TArticoli"."Desc" FROM "TArticoli"

And this means both your table name and the column names are case sensitive, and in that case, quoting those object names is mandatory. Unquoted object names are case insensitive, but are mapped to object names in upper case. This means that select * from TArticoli will select from a table called TARTICOLI, while select * from "TArticoli", selects from a table called TArticoli.

So unless you are going to rename or recreate all your tables or columns, you will not be able to get rid of quotes. The only thing you can do to reduce the number of quotes, is by not prefixing the columns with the table names (in the query shown it isn't necessary), or otherwise use a case insensitive alias for the table, eg

SELECT "IDArticolo", "Desc" FROM "TArticoli"

or

SELECT a."IDArticolo", a."Desc" FROM "TArticoli" AS a
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197