Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 4th, 2004, 11:58 PM
Registered User
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

Old October 7th, 2004, 01:53 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts


Try using a web user control maybe? If you are talking a dynamic number of fields, probably the best way is create your own control to render the contents.

Old October 7th, 2004, 10:06 PM
Registered User
Join Date: Oct 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Sounds like an idea... I will definitely have to deal with it somewhere. Within SQL seems like a good idea so that I can call the stored procedure and just get back results to send to a datagrid.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Temp Table Variable in Stored Procedure rweide SQL Server ASP 2 April 15th, 2011 03:50 PM
Create table/grid from stored procedure bootsy Classic ASP Basics 0 May 22nd, 2008 10:39 AM
Stored Procedure to Local Access Table mmcdonal Access VBA 3 September 21st, 2007 12:00 PM
Add new Table to Stored Procedure pallone SQL Server 2000 2 February 14th, 2007 12:58 PM
Stored Procedure That Updates Table GailCG Classic ASP Professional 1 January 22nd, 2006 01:11 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.