1

I am working with a database with 5 tables, all of which contain different sets of information about clients and their employees. If you drill down in any table for data relating to a particular client, many rows will return according to the number of their employees in the dataset.

If I were to manually run the reports I need, I would query each table, one at a time, for all results where a particular client number is specified. Then I would export each table to a .csv, and then copy those exports into the same excel workbook with 5 tabs (corresponding to the 5 tables in the SQL database). At the end I would have an individual workbook for each client.

A complicating factor is that not every client ID appears in each of the 5 tables. Preferably, I would not export empty datasets and clients with data in only three of the tables would have only three tabs in the final workbook.

Is there way of giving to SQL server a list of Client IDs, for which it should query the 5 tables, export the existing data, and (possibly / hopefully) combine in a workbook on separate tabs.

1
  • Yes there is - retrieving data is what databases do. However, I fear you need to expand your understanding of this before anyone can help you. Your question is so vague as to be unanswerable. Commented Feb 10, 2013 at 8:56

1 Answer 1

3

Your question is rather vague and broad, but here's the key bits of information you'll need to investigate to get things going:

  • Create five different datasets, each querying one table.
  • Create five tablixes, add a PageBreak before each tablix so in Excel they will land on different tabs.
  • Either set a NoRowsMessage or hide the tablix along these lines using an expression based on the RowNumber function
  • Create a parameter for selecting the client ID, and use that in your WHERE clause of the datasets.

The tricky bit would be how to generate multiple Excel files. SSRS does one export at a time, so your basic options:

  1. Put multiple clients in one XLS (i.e. don't use a parameter, but include clientId as a column on the worksheets)
  2. Have the user select one client at a time, and export one XLS at a time.
  3. Automate generating the reports.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks just the kind of direction I was looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.