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
 General SQL Server Forums
 New to SQL Server Programming
 Reg: Procedure Out Put in Sql server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-11 : 09:24:14
madhu writes "Hi friends,

I have one problem Reg: stored procedure out put.My question is my procedure return the out 5 records with 9 columns.
All 5 records out for 8 columns is same only one column is dispaly the out difference . Mu out put is displaying the below format Ex:
col1 col2 col3
abc 1 ed
abc 2 ed
abc 3 ed
abc 4 ed
abc 5 ed

I want out put like this format
abc
2
3
4
5
Ed
All the fields are coming from one table
Ex:Select col1,col2,col3 from table1
Any abody help me out for this issue.Because I need this one very urgent.I was trying to use group by and server ways.But I am not getting the proper solutions.

Help me for this issue.

Thanks
Madhu"

X002548
Not Just a Number

15586 Posts

Posted - 2006-08-11 : 10:31:52
SELECT DISTINCT Col1 FROM table UNION ALL
SELECT Col2 FROM table UNION ALL
SELECT DISTINCT Col3 FROM table

????

doesn't make much sense to me



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2006-08-11 : 13:17:25
:lol: - I thought of that solution, and refused to post it because I thought it was too bizarre. Nice to see it isn't just mye that thinks that way.

BTW- totally agrre - requirement seems bizarre.
Finally, I think you probably want UNION, not UNION all, since we don't know the structure, and possibly 5 could be entered as a value in col1 or col3....

*##* *##* *##* *##*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page
   

- Advertisement -