Firebird 2.5 Language ReferenceFirebird 2.5 Language ReferenceData Definition (DDL) Statements → COMMENTS
Firebird Firebird Prev: ROLEFirebird 2.5 Language ReferenceUp: Data Definition (DDL) StatementsNext: Data Manipulation (DML) Statements

COMMENTS

Table of Contents

COMMENT ON

Database objects and a database itself may contain comments. It is a convenient mechanism for documenting the development and maintenance of a database. Comments created with COMMENT ON will survive a gbak backup and restore.

COMMENT ON

Used for:  Documenting metadata

Available in: DSQL

Syntax: 

COMMENT ON <object> IS {'sometext' | NULL}

<object> ::=
    DATABASE
  | <basic-type> objectname
  | COLUMN relationname.fieldname
  | PARAMETER procname.paramname

<basic-type> ::=
  CHARACTER SET |
  COLLATION |
  DOMAIN |
  EXCEPTION |
  EXTERNAL FUNCTION |
  FILTER |
  GENERATOR |
  INDEX |
  PROCEDURE |
  ROLE |
  SEQUENCE |
  TABLE |
  TRIGGER |
  VIEW
        

Table 5.46. COMMENT ON Statement Parameters

Parameter Description
sometext Comment text
basic-type Metadata object type
objectname Metadata object name
relationname Name of table or view
procname Name of stored procedure
paramname Name of a stored procedure parameter


The COMMENT ON statement adds comments for database objects (metadata). Comments are saved to text fields of the BLOB type in the RDB$DESCRIPTION column of the corresponding system tables. Client applications can view comments from these fields.

[Note] Note

If you add an empty comment (''), it will be saved as NULL in the database.

The table or procedure owner and Administrators have the authority to use COMMENT ON.

Examples using COMMENT ON: 

  1. Adding a comment for the current database
    COMMENT ON DATABASE IS 'It is a test (''my.fdb'') database';
                
  2. Adding a comment for the METALS table
    COMMENT ON TABLE METALS IS 'Metal directory';
                
  3. Adding a comment for the ISALLOY field in the METALS table
    COMMENT ON COLUMN METALS.ISALLOY IS '0 = fine metal, 1 = alloy';
                
  4. Adding a comment for a parameter
    COMMENT ON PARAMETER ADD_EMP_PROJ. EMP_NO IS 'Employee ID';
                
Prev: ROLEFirebird 2.5 Language ReferenceUp: Data Definition (DDL) StatementsNext: Data Manipulation (DML) Statements
Firebird 2.5 Language ReferenceFirebird 2.5 Language ReferenceData Definition (DDL) Statements → COMMENTS