Thursday, February 16, 2012

Adding Comments to Query

Since I compose my query in Query Analyzer and
paste it into RS, I am trying to add comments to the top of my query
to preserve my QA parameters as follows:
/*Testing parameters
declare @.FromPostDate varchar(10), @.AgingDate varchar(10)
Set @.FromPostDate='1/1/2005'
Set @.AgingDate= '11/1/2005'
End Testing Parameters */
But when I paste the query into the RS editor and hit 'Refresh Fields'
I get an error saying 'Must declare the variable @.AgingDate'
If I delete the comment block, it assigns the 2 dates as report parameters
as I would expect. I have tried using '--' instead of /**/ and placing the
dates
on separate lines but it just ignores the comment markers.
Am I missing something?
ThanksIt seems I had a problem like this.. Perhaps try placing any executable
statement prior to the first comment...
--
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
I support the Professional Association for SQL Server ( PASS) and it''s
community of SQL Professionals.
"Mike Harbinger" wrote:
> Since I compose my query in Query Analyzer and
> paste it into RS, I am trying to add comments to the top of my query
> to preserve my QA parameters as follows:
> /*Testing parameters
> declare @.FromPostDate varchar(10), @.AgingDate varchar(10)
> Set @.FromPostDate='1/1/2005'
> Set @.AgingDate= '11/1/2005'
> End Testing Parameters */
> But when I paste the query into the RS editor and hit 'Refresh Fields'
> I get an error saying 'Must declare the variable @.AgingDate'
> If I delete the comment block, it assigns the 2 dates as report parameters
> as I would expect. I have tried using '--' instead of /**/ and placing the
> dates
> on separate lines but it just ignores the comment markers.
> Am I missing something?
> Thanks
>
>

No comments:

Post a Comment