Build a table from a Stored Procedure
Hello everyone,
Here's the issue: I have about 6 tables to relate and pull data from (might not be the best design, but oh well). I am able to pull the data, format dates as needed and have row specifics (ID, etc.).
The way the data is fetched now: Each row will contain about 20 to 30 "categories/types" with different names (so trying to make it dynamic is pretty much out the window). An example is ID, Type1RequiredDate, Type1CompletedDate, Type2RequiredDate, Type2CompletedDate, etc. So if I were to make a table from this, it would be a HUGE set of rows on my ASP.net page (not good, I want to keep scrolling to a minimum).
What I am trying to do: Condense the table on the page: Have each category displayed on its own row (i.e. Row1: ID, Type1RequiredDate, Type1CompletedDate, Row2: ID, Type2RequiredDate, Type2CompletedDate, etc.). In the preceding case the ID's would be the same since the dates came from the same fetched row.
Considerations: If the CompletedDate has a date value there is no need to display it. I more than likely can create this decision process in C# when the table is returned from the database and alter it before handing it to the user, but why not make life difficult and create it in a SQL Server SP?
Thanks for your time!
P.S. Essentially, this is just a while loop that goes through the "RecordSet" of fetched rows and creates a table that is a "broken down" version of the first.
|