Re: How to do...well...any thing...in DB2 SQL
5. Comments
How to do comments in DB2-SQL?
From:
IBM DB2 Universal Database SQL Reference Volume 1 Version 8.2
Chapter 2. Language Elements
Tokens
<quote>
Comments
Static SQL statements may include host language comments or SQL comments.
Either type of comment may be specified wherever a space may be specified,
except
within a delimiter token or
between the keywords EXEC and SQL.
SQL comments are introduced by two consecutive hyphens (--) and ended by the
end of the line.
</quote>
The following DB2-SQL fails:
INSERT INTO Daily_Logs (
Daily_Log_Numbe r, Created_By_User _ID, Property_ID, Shift_ID, Bay_Number,
Supervisor_User _ID, Location_ID, Occurrence_ID, Checklist_ID,
Daily_Log_Type_ ID, Daily_Log_SubTy pe_ID, Start_Date, End_Date,
Description)
VALUES (
'DL-20060307-1', --DailyLogNumber
0, --CreatedByUserID
1, --PropertyID
1, --ShiftID
"A74", --BayNumber
1, --SupervisorUserI D
2, --LocationID
CAST(NULL AS bigint), --Occurrence_ID (must manually cast nulls)
CAST(NULL AS bigint), --ChecklistID (must manually cast nulls)
2, --DailyLogTypeID
5, --DailyLogSubType ID
'2006-03-01 11:11:07.11111' , --StartDate
'2006-03-01 11:21:18.22222' , --EndDate
CAST(NULL AS varchar(1)) --Description (must manually cast nulls)
);
But if a take out the comments, it works. i have no keywords EXEC or SQL,
and i am not putting my comments within a delimiter token "," since i
cannot split a comma into two parts.
*so tired*
5. Comments
How to do comments in DB2-SQL?
From:
IBM DB2 Universal Database SQL Reference Volume 1 Version 8.2
Chapter 2. Language Elements
Tokens
<quote>
Comments
Static SQL statements may include host language comments or SQL comments.
Either type of comment may be specified wherever a space may be specified,
except
within a delimiter token or
between the keywords EXEC and SQL.
SQL comments are introduced by two consecutive hyphens (--) and ended by the
end of the line.
</quote>
The following DB2-SQL fails:
INSERT INTO Daily_Logs (
Daily_Log_Numbe r, Created_By_User _ID, Property_ID, Shift_ID, Bay_Number,
Supervisor_User _ID, Location_ID, Occurrence_ID, Checklist_ID,
Daily_Log_Type_ ID, Daily_Log_SubTy pe_ID, Start_Date, End_Date,
Description)
VALUES (
'DL-20060307-1', --DailyLogNumber
0, --CreatedByUserID
1, --PropertyID
1, --ShiftID
"A74", --BayNumber
1, --SupervisorUserI D
2, --LocationID
CAST(NULL AS bigint), --Occurrence_ID (must manually cast nulls)
CAST(NULL AS bigint), --ChecklistID (must manually cast nulls)
2, --DailyLogTypeID
5, --DailyLogSubType ID
'2006-03-01 11:11:07.11111' , --StartDate
'2006-03-01 11:21:18.22222' , --EndDate
CAST(NULL AS varchar(1)) --Description (must manually cast nulls)
);
But if a take out the comments, it works. i have no keywords EXEC or SQL,
and i am not putting my comments within a delimiter token "," since i
cannot split a comma into two parts.
*so tired*
Comment