Friday, February 24, 2012

Change SQL Command at runtime?

I have tried some of the fixes for the other posts but it still doesn't work.
My query looks like this:
SELECT *
FROM table1 AS t1, table1 AS t2
WHERE t1.id =t2.id + @.myParam
I want @.myParam to have a value of =" AND t1.custId=t2.custId "
How can I make this work?Use an expression as your source. Note that once you do this in the dataset
tab that you can no longer execute the query or get the field list returned
so make sure you have the appropriate field list before you change it to an
expression.
="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
Parameters!myParam.Value
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
>I have tried some of the fixes for the other posts but it still doesn't
>work.
> My query looks like this:
> SELECT *
> FROM table1 AS t1, table1 AS t2
> WHERE t1.id =t2.id + @.myParam
> I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> How can I make this work?|||How do I set the source? This query is a very large query with many other
parameters being used to narrow down the search and return data. I use a
text command type in the data tab.
"Bruce L-C [MVP]" wrote:
> Use an expression as your source. Note that once you do this in the dataset
> tab that you can no longer execute the query or get the field list returned
> so make sure you have the appropriate field list before you change it to an
> expression.
> ="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
> Parameters!myParam.Value
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
> news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
> >I have tried some of the fixes for the other posts but it still doesn't
> >work.
> >
> > My query looks like this:
> > SELECT *
> > FROM table1 AS t1, table1 AS t2
> > WHERE t1.id =t2.id + @.myParam
> >
> > I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> >
> > How can I make this work?
>
>|||Ok I have it figured out. I left the existing parameters setup as is and
just put a =" at the beginning of the query, a " at the end, and took out all
Carriage Returns and it works. Thanks for all of your help!
"KCBTDev" wrote:
> How do I set the source? This query is a very large query with many other
> parameters being used to narrow down the search and return data. I use a
> text command type in the data tab.
> "Bruce L-C [MVP]" wrote:
> > Use an expression as your source. Note that once you do this in the dataset
> > tab that you can no longer execute the query or get the field list returned
> > so make sure you have the appropriate field list before you change it to an
> > expression.
> >
> > ="SELECT * FROM table1 AS t1, table1 AS t2 WHERE t1.id =t2.id " &
> > Parameters!myParam.Value
> >
> >
> > --
> > Bruce Loehle-Conger
> > MVP SQL Server Reporting Services
> >
> > "KCBTDev" <KCBTDev@.discussions.microsoft.com> wrote in message
> > news:95A60AE1-12C4-4CF3-9A82-B037D9E57BFB@.microsoft.com...
> > >I have tried some of the fixes for the other posts but it still doesn't
> > >work.
> > >
> > > My query looks like this:
> > > SELECT *
> > > FROM table1 AS t1, table1 AS t2
> > > WHERE t1.id =t2.id + @.myParam
> > >
> > > I want @.myParam to have a value of =" AND t1.custId=t2.custId "
> > >
> > > How can I make this work?
> >
> >
> >

No comments:

Post a Comment