Saturday, February 25, 2012

Access second grid from SQL stored procedure

Hi:
I have a SQL stored procedure that returns 2 tables. How can I access the
fields from the second table. even though the column names are distinct in
the 2 tables, my reports do not get to the second table's fields. I cannot
join the 2 tables returned. And i cannot have them in 2 separate stored
procedures, because they use the data from the first table.
Please suggest something.
ThanksAre you using temporary tables? Not sure why you can't combine the 2 tables
into a 3rd table to return one result set. Can you explain further?
"NI" wrote:
> Hi:
> I have a SQL stored procedure that returns 2 tables. How can I access the
> fields from the second table. even though the column names are distinct in
> the 2 tables, my reports do not get to the second table's fields. I cannot
> join the 2 tables returned. And i cannot have them in 2 separate stored
> procedures, because they use the data from the first table.
> Please suggest something.
> Thanks|||well my first table is like a summary table, and the second table is like a
detailed table. One issue am having whihc is stopping me from combining both
tables is that the second table has duplicates (whihc I want to show in the
second table but not in the first table). I know SQL RS has the hide
duplicates option, ad if I do a grouping on that particular column it hides
duplicates, but the issue is with the count. If I have just one table (the
one with duplicates in it), I cannot get the right count (without duplicates)
in RS, as it always returns me the count with duplicates. so i had to
separate these two tables.
Also though there a few common columns in these tables, knowing the data I
know it wouldnt make much sense combining them, so I want to leave them as
separate tables.
Right now the workaround I have is have 2 different datasets doing the same
thing, but returning only one of the select statements. But its kinda wierd
to have 2 separate datasets doing the same thing.
Thanks
"phil" wrote:
> Are you using temporary tables? Not sure why you can't combine the 2 tables
> into a 3rd table to return one result set. Can you explain further?
> "NI" wrote:
> > Hi:
> >
> > I have a SQL stored procedure that returns 2 tables. How can I access the
> > fields from the second table. even though the column names are distinct in
> > the 2 tables, my reports do not get to the second table's fields. I cannot
> > join the 2 tables returned. And i cannot have them in 2 separate stored
> > procedures, because they use the data from the first table.
> >
> > Please suggest something.
> >
> > Thanks|||And you never will, except for using aggregation functions.
I think this is a bummer.
Look up SCOPE in the RS help and you will see what I mean.
Here's a sample assuming dataset1 and dataset2:
TextBox1.value = Fields!FirstName.Value
TextBox2.value = Sum(Fields!Income.Value, "dataset2")
BR//Jerry

No comments:

Post a Comment