Thread: SQL comments
How do you comment out SQL? Can you use: '--' or /* */ I tried the '--' briefly and it didn't seem to work and I could find anything, maybe I used the wrong search terms.
You can use comments like this:
--single line comment
/* mutiline comments
are done like this */
/Shoaib
--single line comment
/* mutiline comments
are done like this */
/Shoaib
On 6/11/06, Tom Allison <tallison@tacocat.net> wrote:
How do you comment out SQL?
Can you use:
'--'
or
/*
*/
I tried the '--' briefly and it didn't seem to work and I could find anything,
maybe I used the wrong search terms.
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Tom Allison wrote: > How do you comment out SQL? > > Can you use: > > '--' > or > /* > > */ > > I tried the '--' briefly and it didn't seem to work and I could find > anything, maybe I used the wrong search terms. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings -- at the beginning of EACH line you want to comment works for me. Give that a try and if it doesn't work, you will need to post what you did and what errors you got. Sean
Shoaib Mir wrote: > You can use comments like this: > > > --single line comment > > /* mutiline comments > are done like this */ > Found them, eventually. I was trying to insert a comment in the middle of a line: select status, reason, --method from.... and it didn't like that.
> Found them, eventually. > I was trying to insert a comment in the middle of a line: > > select status, reason, --method > from.... > Actually, you can put a comment in the middle of a line. Your mistake in the above statement is because of the comma before the command, the parser sees this: select status, reason, from .... it's completely legal to write: select status, reason --method from mytable -- line 2 -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook
On 6/11/06, Jaime Casanova <systemguards@gmail.com> wrote: > > Found them, eventually. > > I was trying to insert a comment in the middle of a line: > > > > select status, reason, --method > > from.... > > > > Actually, you can put a comment in the middle of a line. Your mistake > in the above statement is because of the comma before the command, the > parser sees this: > sorry s/command/comment -- regards, Jaime Casanova "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots. So far, the universe is winning." Richard Cook
Jaime Casanova wrote: >> Found them, eventually. >> I was trying to insert a comment in the middle of a line: >> >> select status, reason, --method >> from.... >> > > Actually, you can put a comment in the middle of a line. Your mistake > in the above statement is because of the comma before the command, the > parser sees this: > > select status, reason, from .... > > it's completely legal to write: > select status, reason --method > from mytable -- line 2 > OMG!!! I sit and write SQL ~6 hours a day at work on Oracle. There's something wrong with my brain. Writing SQL on postgresql isn't so strange that I should be making such simple mistakes. I do have to figure out all the date/time formats/functions, but that's just a learning curve. Aggregate goodies are a trick as well. I've been picking up some Oracle specific keywords and it's now taking it's toll. Thank you for putting up with my ignorance. I can't promise it won't happen again, but I think I realize just how careful I have to be on my learning curve.