I've got two datasources, one Oracle and one Sql Server. Due to circumstances that predate me (as in it was like this when I found it) some columns in the Oracle database contain PKs from lookup tables in the Sql Server database.
I am attempting to create a Sql Server Reporting Services report that will combine data from both the Oracle and Sql Server database; where the data to be reported is partially from Oracle but some of the values needs to be looked up in Sql Server.
I've got the datasources. I've got the DataSets. I just can't figure out how to show both datasets in the same tabular report.
Is this possible? If so how so? I'd rather not resort to a db link in one or the other databases as I'd like to handle this on the reporting side.
I don't think you can join directly, but you might be able to add a subreport that would query the second datasource by using the foreign key from the first datasource as a parameter. See: How to: Add a Subreport and Parameters (Reporting Services).
You could also try using the Lookup and Lookupset functions within your tablix.
Lookup is a 1 to 1 join while Lookupset is 1 to many and may need you to have your data concatenated if you want a set of strings out.
For Lookup the following is from the MSDN site with some tweaks for my simple mind
Lookup(Field you are joining from, Field you are joining to, Field you want back, Dataset of the field you want back)
The tablix should be linked to the dataset of your source (joining from).
And just realised this is from 2010, not 2014...so a necro-post!
you could also embed a table inside another table and pass the primary key to the embeded table.
You could create a linked server that would contain data from both instances. From the SSRS point of view you would have one single datasource.
You can use heterogenous services or oracle transparent gateway to run the report off the oracle side. Oracle can query the data from the SQL side.
Related
I have a third party Sql Server data, which I need to use as a data source for my custom database, without duplicating data.
One thing, which comes to mind is to create a View in my custom database, which would reference one or more tables from this third party database.
Is this possible with Sql Server 2014?
Yes, as long as they're on the same server, TSQL: Create a view that accesses multiple databases . If they're on different servers, then you'd have to create a linked server, which I wouldn't suggest unless you're aware of the pitfalls.
Yes very much it is possible but you need to fully qualify the table name like
create view testview
as
select * from db_name.schema_name.table_name
Combobox can be done if SQL Server table is linked. I want to remove table link. What is the record source of combobox which will get list from SQL Server directly? I am using Access 2013 and SQL Server 2014 Express. Thanks.
You can create a select query as a callback query and use that as rowsource for the combobox.
The query will pull the records "directly" from SQL Server.
There not really a practical means to do this that will “help” performance. However, you can certainly build a pass-through query. That means the local Access query will contain RAW t-sql (sql server syntax). This can often increase performance.
Another tip if the query in question has more than one table, then building a SQL view, and then linking to that view works well. You will STILL have a local link that appears as a linked table, and you put JUST the view name in the combo box row source.
You can build in code a DAO (or ADO) recordset, and then assign that recordset directly to the data source of the combo box, but such additional coding does NOT yield any more performance then using a view or a pass-through query (and the view or the pass-through query does not take any code, is less work and results in the same performance anyway).
So at the end of the day simply use a linked table, or as noted a linked view.
I am a SQL Server database developer. We have a current requirement that we need to link our product with an existing application of a client. Our product has a SQL Server 2012 database while the client's existing application uses Oracle 11g. Since the time limit for the project completion is limited we cannot migrate our application to Oracle.
The requirement is that we have to get the customer details from the Oracle database to do billing activities in our system.
So I went through a few links and found that SQL Server linked server can be used to do this. I have successfully created a view which uses the Customer table from the Oracle database using a linked server. It will solve our problem.
Now here are my questions:
Is there any better solutions to do this other than linked server?
Are there any drawbacks when using linked server for this?
Thanks in advance
One drawback to consider is that the filtering on your view may take place at "your" end, rather than in Oracle. e.g. if you have a linked server (using, say, an OPENQUERY statement) and a view based on that and you do this:
select id from myView where id = 4711
expecting that the result will be very quick (assuming id is indexed etc.etc.), then you may be in for a shock as what will actually happen is:
the entire contents of the Oracle table are passed to SQL Server
SQL Server then filters this data, i.e. the filtering cannot be "pushed
down" into the view objects (as they are remote).
N.B.: I know there are two ways to define linked server (openquery and the other one, I forget the details), so this may not always apply, but you should be aware of the potential performance hit.
With Entity Framework 4, can I have 2 tables from different db servers in the same model?
I have table X from SQL Server A and Table Y from Server B.
Is it possible to have different connection string per table under one model or do I need to have different dbml files?
No you can't. Whole EDMX file have single connection string. Moreover EF don't allow fully qualified names of tables. Defining table TableA a from linked server MyServer.MyDatabase.dbo will probably in SQL query result in something like [MyServer.MyDatabase.dbo].[TableA] and it will throw exception.
If you want support tables from two servers in a single model, try to link your second server to the first server and create a view for each table from the second server in your current database on the first server.
IIRC you might be able to fully qualify the table name in the DBML if they are linked servers. I don't have anything to test on, I know you can do it in Linq2Sql on Different databases on the same server.
I am using SSRS 2008 to create a report. Is it possible to create a report from multiple data sources?
Thanks.
With SQL Server Reporting Services 2008 R2 you can use the lookup functions to lookup a piece of data from a second dataset:
http://blog.datainspirations.com/2010/03/19/sql-server-2008-r2-reporting-services-look-up-look-down-look-all-around-part-i/
Very handy.
From older versions of SSRS, you can create a subreport that occupies a cell in a table: the subreport can be called with a different parameter for every row, effectively "joining" to the second dataset.
http://technet.microsoft.com/en-us/library/ms160348.aspx
Yes, you can use multiple Data Sources. Although you can't join the data. For instance, you can't have a table with fields from both Data Sources. BUT you can have a Data Source from Oracle and a Data Source from MS SQL. You can use a List to group things together.
Generally, you'll want to use linked servers if you can and do the work in your query.
You can present data from multiple data sources in a single report, merging datasets from different sources however, is not possible, unless you use some technique to merge this data from the database side, i.e. using a stored procedure. Also if your stored procedure returns multiple result sets, you have to do things like adding them into a table and returning the combined data as a single result, its not terribly difficult, but to your originally stated question, you can use multiple data sources in a report quite easily.