While editing, building up, or cherry picking from SQL statements I can find myself interacting with one of four popular database tools. I have been resorting to single line commenting for DB2 and Informix. I have created macros in vim to make this slightly more efficient but I was wondering if I am working too hard.
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
The ISO standard only defines single-line comments beginning with two dashes. Some vendors support C-style commenting (i.e. multiline beginning with /* and ending with */), but it should not be considered "vendor agnostic".
C style comments are standard in SQL 2003 and SQL 2008 (but not in SQL 1999 or before). The following DBMS all support C style comments:
That is not every possible DBMS, but it is more or less every major SQL DBMS. (I'll willingly add notes about any other DBMS that does - or does not - support C style comments.)
The SQL 2003 standard documents comment notations thus:
IBM Informix Dynamic Server (IDS or Informix) supports C style comments. It also supports '
{ ... }
' as potentially multi-line comments, except in contexts where it means something else - that something else being a LIST or SET or MULTISET literal. (You might find that DB-Access gets confused by C style comments; that is a separate issue.)