Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Report to get data from multiple db Post Reply Post New Topic
Author Message
scommar1
Newbie
Newbie
Avatar

Joined: 10 Apr 2009
Location: United States
Online Status: Offline
Posts: 3
Quote scommar1 Replybullet Topic: Report to get data from multiple db
    Posted: 15 Jun 2010 at 8:27am
I have a Crystal report in teh Dynmics SL program. The report basically gets me data from the company that i have logged into.

I want to get data from multiple databases whenver i run the rport and sort it by database. Is that possible.

Thanks
Sam
IP IP Logged
Emir_W
Senior Member
Senior Member
Avatar

Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
Quote Emir_W Replybullet Posted: 15 Jun 2010 at 7:11pm
it is possible.
as far as i know, you can do it from SQL (not in CR).
 
you should have same Function / Stored Procedure (SP) / Table in each Databases (e.g.: fn_abc() ).
this function is to collect data from the current DB.
 
then make a global function in master DB (e.g.: fn_all()) to call those SP/Func/Table from each DB using UNION all.
and create another simple SP in each DB (e.g.: mysp_xxx)to call the global function.
 
then use this simple SP for Crystal Report (CR) to format the report.
 
here is an example:
 
in DB A: fn_abc() --> to collect records from current db
in DB B: fn_abc()
in DB C: fn_abc()
 
in DB master:  --> to collect records from all db
fn_all()
      select * from a.dbo.fn_abc()
      union all
      select * from b.dbo.fn_abc()
      union all
      select * from c.dbo.fn_abc()
end
 
 
to collect all data from db where we login:
 
in DB A:
alter Procedure MYSP_xxx
select * from master.fn_all()
 
in DB B:
alter Procedure MYSP_xxx
select * from master.fn_all()
 
in DB C:
alter Procedure MYSP_xxx
select * from master.fn_all()
 
 
in this case use MYSP_xxx in your CR.
 
 
hope it help.
and glad if it is
 


Edited by Emir_W - 15 Jun 2010 at 7:20pm
Emir W
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.