Can you put a cf comment inside the cfquery?

<cfquery name="list" datasource = "#dsn#">
<!--- this is a comment, will this query run --->
SELECT Name, Age
FROM studentTable
WHERE Age = 20


7 Years
Discussion Span
Last Post by tiny7415

you are right! however, i am just new in coldfusion. I am just in the process of learning the language. In our company, there is an auto feed that populates 1 of our tables in certain time of the month. I'd like to test if his query does the feeds. but before i take it of the script, id like to make it as a comment and see if my hunch is correct. so if you could help me before this feed happens to my site, that would be great. but if you cant tell me, that's ok.

Im asking only if the script will run or should i put it outside the cfquery script?


Yeah, it will run fine as long as the right syntax is used <!--- comment --->. CF comments are skipped/removed when the code executes. So they're only visible to you, not the receiving program.

You can test it by create a page that displays the current time
<!--- what happens to this comment? --->

Run the page and do a view source. Notice CF comment isn't visible in the generated html? It's automatically removed when CF compiles the code.

(When I first learned CF, I didn't realize CF comments have 3 dashes "-". So I was only using 2 and kept wondering why it didn't work ;)


Thank you Arrrgh!!! I hope that what I did to the script will not ruin our site. I will let you know if the auto feed will not affect my main table.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.