Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Proc-distributed database

Author  Topic 

Wulan22
Starting Member

5 Posts

Posted - 2004-03-24 : 18:03:59
In a Sybase distributed database environment - one central database and nine distributed (matching tables/fields etc) databases.

I'm trying to create reports using a stored procedure that will loop through all databases gathering data if criteria meets and pulling it all in to one report.

Does anyone have any examples of a stored procedure that does this or ideas on the simplest uncongested way to do this?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-24 : 18:17:28
Looping is not a good idea. You will have performance problems.

Also, this is a MS SQL Server site.

Tara
Go to Top of Page

Wulan22
Starting Member

5 Posts

Posted - 2004-03-24 : 18:38:40
Oops..no Sybase experts out there?

Thanks for the looping info...what would you suggest?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-24 : 19:01:39
It sounds like you'll need to use dynamic sql and a loop. Does Sybase have a sp_MSforeachdb stored procedure that you can use to run queries against all dbs?

Tara
Go to Top of Page
   

- Advertisement -