#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    10
    Rep Power
    0

    Query to get the column name from the database


    Hi,

    Can any one let me know how we can get the column name of particular table?

    Its urgent!!!!

    BR
    vikas
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Sarajevo, Bosnia
    Posts
    120
    Rep Power
    14
    Originally Posted by vikas.sh1
    Hi,

    Can any one let me know how we can get the column name of particular table?

    Its urgent!!!!

    BR
    vikas
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS where RDB$RELATION_FIELDS.rdb$relation_name = :TABLE_NAME
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    10
    Rep Power
    0
    Thanks for the reply.

    I tried running the same query in firebird SQL manager.
    it prompt me to enter table name.

    when i enter the table name it shows column name.

    I have to do it in c++. can you just clear the prompt section.

    i tried the below query but giving an error
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS
    where RDB$RELATION_FIELDS.rdb$relation_name = alarmjournal;

    Originally Posted by fikret
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS where RDB$RELATION_FIELDS.rdb$relation_name = :TABLE_NAME
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Sarajevo, Bosnia
    Posts
    120
    Rep Power
    14
    Originally Posted by vikas.sh1
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS
    where RDB$RELATION_FIELDS.rdb$relation_name = alarmjournal;
    Try
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS
    where RDB$RELATION_FIELDS.rdb$relation_name = 'alarmjournal';
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    10
    Rep Power
    0
    Dynamic SQL Error.
    SQL error code = -206.
    Column unknown.
    ALARMJOURNAL.
    At line 2, column 47.

    From the second one i am getting
    Emptyset
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    74
    Rep Power
    5
    Consider installing the free Firebird database administration tool:

    Flamerobin

    Connect, browse to tables --> your answer without technical bla bla and difficult queries.

    Its a pitty that Firebird does not support MySQL commands like

    "SHOW TABLES" (--edit--: sorry it does but not: ) "DESCRIBE [tablename]"

    So much easier, right?

    So Flamerobin, looks a bit like pgAdmin.


    Good luck!
    Last edited by rapgame; November 13th, 2011 at 12:58 PM. Reason: statement was not true
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Sarajevo, Bosnia
    Posts
    120
    Rep Power
    14
    Originally Posted by vikas.sh1
    Dynamic SQL Error.
    SQL error code = -206.
    Column unknown.
    ALARMJOURNAL.
    At line 2, column 47.

    From the second one i am getting
    Emptyset
    Try
    select RDB$RELATION_FIELDS.rdb$field_name from RDB$RELATION_FIELDS
    where RDB$RELATION_FIELDS.rdb$relation_name = 'ALARMJOURNAL';
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Sarajevo, Bosnia
    Posts
    120
    Rep Power
    14
    Originally Posted by rapgame
    Its a pitty that Firebird does not support MySQL commands like "SHOW TABLES"
    It does support SHOW TABLES; command, using ISQL tool.
    Be carefull with your words ;-)
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    74
    Rep Power
    5
    You right Fikret, "Show tables" is supported, "describe" not.

IMN logo majestic logo threadwatch logo seochat tools logo