I’d like to build a report in SSMS so that you can click on an object, choose the report, and it queries a data source (not the server you’re looking at itself) to return information about that object.
All the SSMS reports I’ve seen use an empty data source (Data Source=.), so that SSMS runs it against whichever database/server/object you’re clicking on. I’m saving historical info on a different server.
I know it’s possible; according to http://sqlbg.wordpress.com/2011/03/06/how-to-create-custom-reports-for-sql-server-management-studio/ there are 6 parameters passed. I’d like to run a query against my data source, ideally passing those 6 parameters to an SP on my repository data source.
I took the code in the link above and created an RDL, then imported it into my project (SSDT and BIDS 2005 both; same issue). It works in the Preview mode, returning a dataset from an Embedded Datasource in the report – but when I open the RDL in SSMS, I get “invalid object name “mytablename”‘ (where mytablename is the name of the table in my query). So it looks like it’s not properly using the data source. Profiler confirms this – there’s no login to the server at that time.
I have successfully reproduced the problem in SSDT and BIDS 2005 (8.0.50727.4039, Microsoft Visual Studio 2005 Tools for Applications)
Many thanks!
It appears that SSMS will ONLY use the SQL Server you’re clicking on as the data source, no matter what you actually use. This is probably for security, but it makes cross-server reports more difficult.
To work around this, I created a linked server (RPC OUT on, collation compatible = true), using a specific user who only had read permissions.
If anyone knows of any cross-server reports that work in SSMS, please let me know – I’d love to know how they did it.