Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » UltraLite - 数据库管理和参考 » UltraLite SQL 参考 » UltraLite SQL 元素

 

UltraLite 中的注释

注释用于在 SQL 语句或语句块中附加说明性文字。UltraLite 运行时不执行注释。

UltraLite 中使用以下几种注释指示符:

  • -- (双连字符)   数据库服务器忽略行上的任何其余字符。该指示符是 SQL/2003 注释指示符。

  • // (双斜线)   双斜线与双连字符的含义相同。

  • /* ... */(斜线加星号)   忽略两个注释标记间的任何字符。两个注释标记可以在同一行上或者在不同的行上。可以嵌套以此风格指示的注释。这种注释风格也称为 C 样式注释。

    注意

    UltraLite 不支持百分号 (%)。

示例
  • 以下示例说明了如何使用双连字符注释:

    CREATE TABLE borrowed_book (
       loaner_name CHAR(100)      PRIMARY KEY,
       date_borrowed DATE NOT NULL DEFAULT CURRENT DATE,
       date_returned       DATE,
       book                CHAR(20)
       FOREIGN KEY book REFERENCES library_books (isbn),
    );
    --This statement creates a table for a library database to hold information on borrowed books. 
    --The default value for date_borrowed indicates that the book is borrowed on the day the entry is made. 
    --The date_returned column is NULL until the book is returned.
  • 以下示例说明如何使用 C 样式注释:

    CREATE TABLE borrowed_book (
       loaner_name CHAR(100)      PRIMARY KEY,
       date_borrowed DATE NOT NULL DEFAULT CURRENT DATE,
       date_returned       DATE,
       book                CHAR(20)
       FOREIGN KEY book REFERENCES library_books (isbn),
    );
    /* This statement creates a table for a library database to hold information on borrowed books. 
    The default value for date_borrowed indicates that the book is borrowed on the day the entry is made. 
    The date_returned column is NULL until the book is returned. */