|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 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. Hi
You would be better of leaving this for the front end otherwise it would mean resorting to cursors and dynamic SQL. John Show quote "KssKumar2000" wrote: > 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. > > 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,'') -- Show quotethanks, ------------------------------------ Jose de Jesus Jr. Mcp,Mcdba MCP #2324787 "KssKumar2000" wrote: > 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. > > 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. 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! Show quote "--CELKO--" <jcelko***@earthlink.net> wrote in message news:1134740263.450919.20570@g47g2000cwa.googlegroups.com... > 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. > 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 Show quote "Tony Rogerson" <tonyroger***@sqlserverfaq.com> wrote in message news:eLEMwGlAGHA.2040@TK2MSFTNGP14.phx.gbl... > 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 > > > "--CELKO--" <jcelko***@earthlink.net> wrote in message > news:1134740263.450919.20570@g47g2000cwa.googlegroups.com... > > 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. > > > > |
|||||||||||||||||||||||