question

nabeed avatar image
nabeed asked

45 sql mdf ldf query databese

Is it possible to connect together SQL query 45 MDF LDF DETABESE to get report in excel one short in 45 sheets.
mdfldf
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Can you please clarify? Are you meaning to write a query that would join up to 45 databases? Not sure what you mean.
2 Likes 2 ·
Thanks for taking interest on my question. Yes I have 45 different Database thru which i need to connect all to gether by a query to take reports on different sheets of Excel.
0 Likes 0 ·
Wilfred van Dijk avatar image
Wilfred van Dijk answered
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Wimbush avatar image
David Wimbush answered
Getting it into separate tabs in Excel is going to be the most difficult part. Does it *have* to be Excel? It would be very easy to do it as a SQL Reporting Services report. You could use sp_msfoeachdb to iterate through the databases, use db_name() to include the database name in the resultset, and use a Table contained in a List that splits on database name to present them as separate tables. If you don't fancy that, have a look at what's involved in doing it with Integration Services (eg. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/0fbefeb2-b22d-4774-b1b0-069c6f729160/capture-output-of-multiple-sql-queries-in-separate-tabs-of-an-excel-workbook?forum=sqlintegrationservices).
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.