what is error in this stored procedure

Posted by Lakn2 under Sql Server on 7/16/2011 | Points: 10 | Views : 816 | Status : [Member] | Replies : 5
hi my stored procedure is

ALTER procedure [dbo].[get_finalcash]
(@regdno varchar(25),
@total money,
@advance money,
@deduction money,
@netamount money,
@todate datetime,
@paid money,
@due money,
@to money,
@to1 money,
@to2 money,
@to3 money

)
as
begin
select f.regdno,f.name,f.doa,f.time,f.advance,f.dod,f.time1,f.billno,e.rddp,e.napa,e.na,e.total from finalbill f
inner join efinalbill e on f.regdno=e.regdno where f.regdno=@regdno

select rddp as OtherEx,total as Total from efinalbill where regdno=@regdno and head='Other Expenses'
end



i am getting this store procedure into crystal report but i am getting first statement values only
how can i get second statement values also

Thanks&Regards
LakshmiNarayana Nalluri.



Responses

Posted by: PandianS on: 7/16/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

According to your procedure, It returns TWO result set. correct ?

Try to join/combine the both result set into a single...



Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Laghaterohan on: 7/17/2011 [Member] Starter | Points: 25

Up
0
Down
If you are getting more than 1 result set which u must b , while using it crystal reports try writing it to xml file and use xml file as a datasource for the crystal report...it works fine.


Thanks!

Best Regards,
Rohan Laghate

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/17/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
This is not a good way to write a storedprocedure.

You can return two results in one storedProcedure, i was gonna say use a union to combine the results but the Column are not the same. You need to execute this in different StoredProcedure, unless you explain your problem in detail we might suggest other solutions.





Thank you for posting at Dotnetfunda
[Administrator]

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/18/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

i want get data from two tables finalbill,efiinalbill to display records based on regdno (first report ) based on regdno,head(2ndReport)
that's why i wrote two select statements. but my problem is in sql server sp is executing good.but in crystal report it returns first statement values only.




Thanks&Regards
LakshmiNarayana Nalluri.

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/18/2011 [Member] Starter | Points: 25

Up
0
Down
hi Laghaterohan ,

can you send me any reference link or example

Thanks&Regards
LakshmiNarayana Nalluri.

Lakn2, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response