Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Formatted Output needed

Author  Topic 

caterpillar
Starting Member

9 Posts

Posted - 2006-10-02 : 17:35:27
Hi All,

I have a stored procedure which displays list of ADMITTED,QUEUED and DISCHARGED patients. The patient status is stored in a table. A represents ADMITTED patient, Q represents QUEUED patient and D represents DISCHARGED patient. I am using a dropdown to display the ADMITTED,QUEUED and DISCHARGED patients respectively. I need to add a new option in the dropdownas ALL which displays all i.e., ADMITTED,QUEUED and DISCHARGED patients but in a classified manner on the same page like:

ADMITTED
--------
RegNo PatientName Age
---- ----------- ---
A1 PNA 70

QUEUED
--------
RegNo PatientName Age
---- ----------- ---
D1 PNQ 53

DISCHARGED
--------
RegNo PatientName Age
---- ----------- ---
Q1 PND 45


How should i code my stored procedure for this kind of formatted output?

Thanks!

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-10-02 : 17:55:59
Do you absolutely have to create the formatted output in your stored proc? It's normally better to do this in your front-end application or reporting app.
Go to Top of Page

caterpillar
Starting Member

9 Posts

Posted - 2006-10-02 : 23:48:15
Thanks for your reply timmy. I agree with you but i find the already created front-end application quite complicated to do this. It will require complete change of display. I am assuming if i can make the desired SQL Query & call it as a data table in my VB.NET front-end.
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-10-03 : 01:49:55
Yes, but you've still got the problem of getting all the column alignment right. And make it look nice with the headings you have. And it will also depend on you using a font whose letters are the same width (not sure of the correct term for this...) At the end it will still look dodgy.
You might even find the time it takes to write this stored proc properly (and debug it) is similar to the time it takes to do it properly in the first place. Remember you also have to maintain the code later on (unless you're a contractor/temp....)

HTH,

Tim
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-03 : 09:02:19
Backend is to store data and Front end is to format it
Why cant you display in .NET application?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

caterpillar
Starting Member

9 Posts

Posted - 2006-10-03 : 10:01:50
Hi Timmy & Madhivanan! Probably i need to correct myself of saying that the output should be formatted through the stored proc. I must format the displayed output through my front-end. All what i need is a query which can produce the kind of output i need in my case

PATIENT STATUS 1 value in ROW 1
PATIENT DETAILS 1 in NEXT ROW


PATIENT STATUS 2 value in NEXT ROW
PATIENT DETAILS 2 in NEXT ROW

PATIENT STATUS 3 value in NEXT ROW
PATIENT DETAILS 3 in NEXT ROW

I will be able to Format my desired display only once i get it through the stored proc.
Am i right?

Plz. suggest
Thanks!


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-03 : 10:25:49
Send the required data to Front end and format it there. It is not neccessary to return formatted data

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-10-03 : 17:48:34
As a starting point, you can output more than one recordset from a stored procedure. This might help in separating the different statuses.
But Maddy's right - stored procs are for returning unformatted data. Trying to get them to do formatting is asking for trouble.

Go to Top of Page

caterpillar
Starting Member

9 Posts

Posted - 2006-10-08 : 10:39:32
Yeah Guys, i am getting the things now.

Thanks!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-09 : 09:57:07
quote:
Originally posted by caterpillar

Yeah Guys, i am getting the things now.

Thanks!


Thats good anyway

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -