Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multple SQL Databases with same Table Names -- Crystal Reports

Posted on 2009-05-12
2
Medium Priority
?
199 Views
Last Modified: 2012-05-06
I am using Crystal Reports to access data in a SQL Express 2008 instance, but my question is more a general SQL quesiton than a Crystal Reports question.

I am presently using "AccessBooks RealTime" to export the data from about 10 QuickBooks files into SQL. "AccessBooks RealTime" does not support importing multiple QuickBooks files into one database, since List ID's are not unique across QuickBooks files.

Presently, I have a database for each QuickBooks file, and the sync is working fine between the QB files, and their respective databases.

What I want to be able to do, is show certain pieces of information from each database, alongside one another. For example, there is an "Accounts" table, which has two fields, "AccountType", and "AccountBalance". I would like to be able to pull this data from databases A, B, and C. Of course, the table name, and the field name is identical on all three databases.

I somehow need to "flag" which database each piece of data is coming from. In the above example, I might want to display Cash Balance by Company. Then I would want to filter where AccountType == Cash, and then show the balance for Company A, Company B, and Company C, all together.

Hopefully that makes sense. Any ideas on how to achieve something like that? Is there any way I could create a view that aggregates all of my various databases into one, with a new field or prefix that specifies what database it is coming from?

I have also looked at qODBC to export QB data to SQL, which appears to be more flexibile, but I would have to write the update statements to migrate the data to SQL manually. Of course, then I could probably add my own prefixes to each table as it is updated, but that seems like a lot of work.
0
Comment
Question by:netmergence
2 Comments
 
LVL 6

Accepted Solution

by:
BALMUKUND KESHAV earned 2000 total points
ID: 24371579
Use Database.Tablename in select statement if you are using same tablename from more than one database, use database1.tablename1.AccountType as accounttypeA or database2.tablename2.AccountType as accounttypeB something like that .
or
Make different views for different databases and use filedname as asyoulikefieldname in views and finally use the different views to make a final sql/views.

Bm Keshav

0
 

Author Closing Comment

by:netmergence
ID: 31580841
I knew there would be an easy solution. "select as" fits the bill perfectly. Thanks!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question