all groups > sql server programming > december 2005 >
You're in the

sql server programming

group:

Is it possible to get all the column values in a single column?



Is it possible to get all the column values in a single column? KssKumar2000
12/15/2005 11:25:30 PM
sql server programming: Hi

Is it possible to get all the column values in a single column from a
table?

For e.g.

a1 a2 a3
== == ==
1 2 3
4 5 6

I need the output like

Allcolums
***********
123
456


I am not ready to mention the column names in the query. It should be
generic.

Thanks in advance.
RE: Is it possible to get all the column values in a single column? John Bell
12/15/2005 11:55:03 PM
Hi

You would be better of leaving this for the front end otherwise it would
mean resorting to cursors and dynamic SQL.

John

[quoted text, click to view]
RE: Is it possible to get all the column values in a single column? Jose G. de Jesus Jr MCP, MCDBA
12/16/2005 4:37:02 AM
will this work
assuming that each column is of string data type

select a1+a2+a3 from table

or this one if you have nulls
select isnull(a1,'')+isnull(a1,'')+isnull(a1,'')


--
thanks,

------------------------------------
Jose de Jesus Jr. Mcp,Mcdba
MCP #2324787


[quoted text, click to view]
Re: Is it possible to get all the column values in a single column? --CELKO--
12/16/2005 5:37:43 AM
You might want to learn about First Normal Form (1NF) and what a tiered
architecture is before you try SQL coding. You have missed the
foundations and are asking for kludges in Newsgroups when you need to
be studying.

If you **really** want to be a bad programmer, look up cursors and
always comment your code with a note that it needs to be replaced by a
good SQL programmer.
Re: Is it possible to get all the column values in a single column? 05ponyGT
12/16/2005 12:58:27 PM
Yes BUT....the ng needs wits regardless of the adjective(s) or
quantity(s) that realistically apply :)

Happy Holidays to the full spectrum of wits...
www.rac4sql.net

[quoted text, click to view]

Re: Is it possible to get all the column values in a single column? Tony Rogerson
12/16/2005 3:07:06 PM
You might want to find out why the poster wants to do this before you slag
him or her off.

Just because with your limited real industrial experience in programming
you've not come across a need for this doesn't make the poster a bad
programmer.

You need a serious lesson in maners - go back to school and learn how to
interact with society, perhaps you should just shut up with the dissing
people on here and take lessons on how to politly communicate with people!

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials


[quoted text, click to view]

AddThis Social Bookmark Button