x
login about faq Site discussion (meta-askssc)

reporting service tsql syntax - commenting

Hi All

In a recent post I indicated that I've just moved into a new job (reporting) in a new organization and I've noticed some oddness that may or may not be significant. In the SQL that goes into the rdl files here, I've noticed that there is almost NEVER any commenting in the code. Furthermore, there is often a complete absence of easy-on-the-eye formatting, with everything jammed up against the left margin.

Am I missing something here? These people have years of experience with SSRS whereas I have less than 12 months and so I'm wondering whether there are any gotchas that mean you should not comment the code in RDLs the way you would in a *.sql file.

Regards GPO

more ▼

asked Aug 06 '10 at 11:32 PM in Default

GPO gravatar image

GPO
1.7k 26 30 33

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

I've put comments into SSRS queries before without any problems. And formatting does get retained.

I suspect that the more complex queries are developed outside of SSRS before being copied in, or built up using the query designer, which may not be so well-behaved.

more ▼

answered Aug 07 '10 at 12:09 AM

ThomasRushton gravatar image

ThomasRushton ♦
29.4k 6 9 36

(comments are locked)
10|1200 characters needed characters left

@ThomasRushton I have discovered a gotcha (in SSRS2000 at least). If you put something in a comment that can be interpreted as a parameter it looks like you'll throw an error message. I had:

-- ? some comment 

in an rdl and got the following message

"An error occurred while executing the query. Incorrect syntax near '?'..."

Same thing occurs with

/*? some comment */
more ▼

answered Aug 09 '10 at 06:23 PM

GPO gravatar image

GPO
1.7k 26 30 33

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x913
x486
x7

asked: Aug 06 '10 at 11:32 PM

Seen: 728 times

Last Updated: Aug 06 '10 at 11:32 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.