SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2004
    Location
    Ottawa, Canada
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    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:

    Code:
    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.

    Thanks

    Colin

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,022
    Mentioned
    53 Post(s)
    Tagged
    2 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
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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