473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to combine both row data with column name and get as output

3
Hi,
i had a table like below which contains some rows and columns.

rowid a b c
1
2
3

now i want the output like

rowid a b c
1 a1 b1 c1
2 a2 b2 c2
3 a3 b3 c3

it's a combination of both row data and column name.
Jul 3 '12 #1
3 1883
Rabbit
12,516 Expert Mod 8TB
I don't see the point of this, but just use the concatenation operator.
Expand|Select|Wrap|Line Numbers
  1. SELECT 'a' + rowid, 'b' + rowid, etc...
Jul 3 '12 #2
lohima
3
hi Rabbit,
thank you for ur reply. i tried this already it is showing datatype error.
when i used datatype conversion i am getting the data.

'select 'a'+cast(a as varchar(10))+' '+cast(rowid as varchar(10)','b'+cast(a as varchar(10))+' '+cast(rowid as varchar(10)', etc...'

what i need is i dont want to add column name "['a' +]" here to get output as a1. Is there any other possibility to get column name directly other than giving that name.

thank you
Jul 4 '12 #3
Rabbit
12,516 Expert Mod 8TB
You don't really have a choice except to provide the column names. You could query the system tables and build a dynamic query through that, but that's a lot of work.
Jul 4 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Shino | last post by:
Hi, Can anyone help with this error: "ORA-00904: invalid column name"? Thanks! SQL> create view PPFa as 2 SELECT L.UserID AS LecID, U.Name, U.Email, I.IntakeID, S.UserID AS StudID 3 FROM...
1
by: ibm_97 | last post by:
DB2 8.2 on AIX Hi, I'd like to change a column's name in a table which is part of replication. This column is identity column (generated always). 1. Since DB2 will drop and recreate the...
10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
2
by: Stephen Costanzo | last post by:
I have a control table that lists the columns to pull from the associated data table. If there is a column name in the control table that doesn't exist in the data table, it generates a...
6
by: Jeff | last post by:
The code below will correctly locate the last entry in a particular SQL Table in VWeb 2005 with VB. How can I determine the column name associated with the column number x? Dim tempA As...
1
by: imauser | last post by:
I have a database(PostgreSQL) table(about 70k rows).I am developing an ASP webpage and there is a list-box on it which contains the name of the columns of that table. User selects the column name...
1
by: Rahul Babbar | last post by:
Hi, I tried to generate the query plan for a query using a tool called Aqua Data Studio. It showed the explain plan and showed that a particular scan on a particular table was taking a long...
1
by: KK | last post by:
Hello Everyone, i have a column named "Cell No" but when am trying to get data from it using query "select * from data where Cell No=?" it throws an error i know the problem is because of the...
2
by: Big Daddy | last post by:
For example, if I have a DB table called DownloadPoints with a column named DownloadPointNo, then SqlMetal will create a file with a class called DownloadPoints with an accessor named...
1
by: sachinkale123 | last post by:
Hi, I am reading excel file and reading values from that I am using provider As : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " + Filename + ";Extended Properties=\"Excel 8.0;Hdr=No;IMEX=1\"";...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.