SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2004
    Ottawa, Canada
    0 Post(s)
    0 Thread(s)

    Using Reserved Word TimeStamp as a field name (Firebird 2.5)

    Am extending the data layer of an existing application to work with FireBird 2.5, in addition to MSSQL and SQLite, but have hit a stumbling block.

    I have a field called TimeStamp which stores the data/time as type TimeStamp. This works fine under MSSQL and SQLite where the type is datetime, but falls over under Firebird. The following SQL:

    SELECT SysTrnId,'TimeStamp' from "TRANSACTIONS"
    seemingly works, but the TimeStamp field is return as fieldname "CONSTANT" and the contents are the text "timestamp"

    Is it possible to do this under FireBird, or am I going to have to rename the field and change the code in the other data layers.



  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Toronto, Canada
    63 Post(s)
    3 Thread(s)
    i don't do firebird, but if you can use doublequotes around the tablename (which is standard SQL), then you can do the same around column names

    SELECT SysTrnId, "TimeStamp" from "TRANSACTIONS"

    the only problem, of course, is that this won't run in all databases

    the ~best~ strategy is not to use a column or table name that might be a reserved word in ~any~ database system

    so yeah, i think this would be a good time to rename your columns | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts