Wednesday, March 28, 2012

How can I combine two report parameters into a string?

Sorry, I am new to the SQL reporting. I am not sure whether I can combine
two report parameters in a string and then use it in my querystring or not.
For example, I have a report paramter called "Month" and the other one
called "Year". Obviously I want to make them as a start date for my report
and them pass this into my querystring. Can I achieve this without writing a
stored procedure for this purpose?
ThanksUse the command type of text.
exec sp_my_stored_procedure @.Month + @.Year, @.Param3, @.Param4
or
select * from table where date = @.Month + @.Year
--
Harolds
"Laipond" wrote:
> Sorry, I am new to the SQL reporting. I am not sure whether I can combine
> two report parameters in a string and then use it in my querystring or not.
> For example, I have a report paramter called "Month" and the other one
> called "Year". Obviously I want to make them as a start date for my report
> and them pass this into my querystring. Can I achieve this without writing a
> stored procedure for this purpose?
> Thanks|||Harolds,
Thanks for the reply. I have tried the way you mentioned below. Following
is what I did and the result I got:
Case 1. In "Define Query Parameter" dialog box, I type 3/1/2005 for @.month,
and leave @.year blank. The reporting service can successfully pull the data.
Case 2. In "Define Query Parameter" dialog box. I type 3/1/ for @.month and
2005 for @.year. An error happen: "Application uses a value of the wrong type
for the current operation."
Is there any other function I can apply for this query string to make it work?
Thanks
Laipond
"Harolds" wrote:
> Use the command type of text.
> exec sp_my_stored_procedure @.Month + @.Year, @.Param3, @.Param4
> or
> select * from table where date = @.Month + @.Year
> --
> Harolds
>
> "Laipond" wrote:
> > Sorry, I am new to the SQL reporting. I am not sure whether I can combine
> > two report parameters in a string and then use it in my querystring or not.
> >
> > For example, I have a report paramter called "Month" and the other one
> > called "Year". Obviously I want to make them as a start date for my report
> > and them pass this into my querystring. Can I achieve this without writing a
> > stored procedure for this purpose?
> >
> > Thanks|||You are getting that error because you have @.Month and/or @.Year set to a
datetime data type instead of string.
--
Harolds
"Laipond" wrote:
> Harolds,
> Thanks for the reply. I have tried the way you mentioned below. Following
> is what I did and the result I got:
> Case 1. In "Define Query Parameter" dialog box, I type 3/1/2005 for @.month,
> and leave @.year blank. The reporting service can successfully pull the data.
> Case 2. In "Define Query Parameter" dialog box. I type 3/1/ for @.month and
> 2005 for @.year. An error happen: "Application uses a value of the wrong type
> for the current operation."
> Is there any other function I can apply for this query string to make it work?
> Thanks
> Laipond
> "Harolds" wrote:
> > Use the command type of text.
> > exec sp_my_stored_procedure @.Month + @.Year, @.Param3, @.Param4
> > or
> > select * from table where date = @.Month + @.Year
> > --
> > Harolds
> >
> >
> > "Laipond" wrote:
> >
> > > Sorry, I am new to the SQL reporting. I am not sure whether I can combine
> > > two report parameters in a string and then use it in my querystring or not.
> > >
> > > For example, I have a report paramter called "Month" and the other one
> > > called "Year". Obviously I want to make them as a start date for my report
> > > and them pass this into my querystring. Can I achieve this without writing a
> > > stored procedure for this purpose?
> > >
> > > Thanks

No comments:

Post a Comment