how to display multiple rows of a table in single row

DECLARE @emp VARCHAR(1024)
declare @emp1 varchar(1024)
declare @emp2 varchar(1024)
SELECT
@emp1 = COALESCE(@emp1 + ',', '') + cast(eid as varchar(10)),
@emp = COALESCE(@emp + ',', '') + ename ,
@emp2 = COALESCE(@emp2 + ',', '') + desig
FROM emp
SELECT eid=@emp1,ename = @emp,desig=@emp2

 

0
anitha123
12/15/2007 7:00:54 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
790 Views

Similar Articles

[PageSpeed] 39

 

anitha123:
DECLARE @emp VARCHAR(1024)
declare @emp1 varchar(1024)
declare @emp2 varchar(1024)
SELECT
@emp1 = COALESCE(@emp1 + ',', '') + cast(eid as varchar(10)),
@emp = COALESCE(@emp + ',', '') + ename ,
@emp2 = COALESCE(@emp2 + ',', '') + desig
FROM emp
SELECT eid=@emp1,ename = @emp,desig=@emp2

Please be clear what is your requirement.

 


Click on 'Mark as Answer' if this post is helpful.

ImranKhan pathan
0
impathan
12/15/2007 7:55:42 AM
Reply:

Similar Artilces:

Display multiple table rows in a single Gridview row?
I have two tables:   transportreply |id| |submitby| |transport| 2008 |id| |liftclub| |liftclubsize| |workfromhome| |leave| |submitby| In the transportreply, there are multiple rows with information submitted by the same user originating from a checkboxlist.  What I need is an inner join of the two tables that display all the results on one Gridview row.  Currently my code looks like this: Results.aspx<table align="center" width="900" bgcolor="#E6E6E6" class="table3"><tr><td><div class="td4&q...

Can you display data from a single row in multiple rows using a GridView?
I am currently displaying 3 fields in a gridview and it looks something like this:First Name Last Name Age ======== ======== === Chris Messineo 40 John Smith 35 Tim Jones 30I need to modify the gridview and display a bio, but I want it to display on 1 full line below each line, like this:First Name Last Name Age ======== ======== === Chris Messineo 40 Chris was born in a log cabin... John Smith 35 At the age of 10 John invented... Tim Jones 30 Mr. Jones was always a curio...

Select rows from a table based on multiple rows of another table
I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. ...

Inserting values from multiple SqlDataSource(dropdownlist) to a single row in SQL Table
Hi, I am new to ASP.net and VB programming. I use mostly the wizards and dragging of controls to the design view, so I'm not able to do code-behind programming yet. What I've done is mostly from looking at sample code and editing. The page I am having problems with is as follows; I have a 4 DropDownList controls on my page. These contain values which are taken from the SQL database, using SqlDataSource. Each control has its own Datasource. The four DDLs each take values from 4 different tables. Upon choosing all 4 values, the user clicks on the submit button and 3(yes 3) ...

Inserting all rows of a datatable into Oracle Table in a single shot, not row by row using C#
Hi All... I have imported the data of CSV File into Datable using C#. Now i need to insert the content of DataTable to the table in Oracle Database in a single shot, without looping through the rows of the datatable. Is this Possible? Please help me out by providing the sample code. Below is sample code for Importing the CSV Data to Dataset string connString =string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text;",Path.GetDirectoryName(filename)); string cmdString =string.Format("SELECT * FROM {0}", Path.G...

Select rows from a table based on multiple rows of another table #4
I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. ...

Select rows from a table based on multiple rows of another table #2
I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. Sorry technical problems! I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. I have a table which holds all of my project info and I have another table which holds discriptive project codes like project type, project category, progect life cycle.So in the pro...

Select rows from a table based on multiple rows of another table #3
I am working in a database associated with our scheduling package and I am trying to select rows in one table based on multiple rows in another table how ca I do this. Here is an example. ...

SQL Data displayed row by row
Hi,  I was wondering if it was possible to get some help, what I am trying to do is create a ASP webpage that will display Data from an sql database row by row and if there is no data in one row then it will display a message saying "No Data in row"  Any help would be appreciated  Thanks, Michael   mstoten: I was wondering if it was possible to get some help, what I am trying to do is create a ASP webpage that will display Data from an sql database row by row and if there is no data in one row then it will display a message saying "No Data i...

HTML table row
Hi, I am using asp.net 3.5.Below is the code from markup area, my requirement is - I placed 2 options buttons on the page. when user click on first button the first row should be (2nd row shoud be hidden here)visible, if select 2nd button the 2nd row should be visible in the same place as the first row (1st row shoud be hidden here)- something similar we do in windows programming,IS POSSIBLE<asp:TableRow ID="TableRow34" Height=30 runat="server" style="font-size:11px;color:#0033FF"> <asp:TableCell ID="TableCell74" columnSpan=4 HorizontalAlign =...

convert multiple row values into single row
Hi All, I have to convert multiple row values into single row with multiple columns, can anybody help me in this regard. Thanks in advance. can u provide some information. i didn't get ur  requirement properly. Clarity is needed.Thank uBabaPlease remember to click "Mark as Answer" on this post if it helped you. Hi,   Maybe a Pivot Query is what you're looking for? Greg...

How do I display data from an sql query row by row?
I have the following code (at bottom of msg) in a page I'm trying to write. It works ok with a datagrid but I don't want a datagrid on the page as they look ugly (by default). Questions ... 1. Can I use a datagrid to display data with a custom layout? 2. How can I access data obtained from an sql server stored procedure row by row? I'm told you do it with a Dataset but I don't know how. The site is to look like this ... http://www.numbersix.co.nz/temp/intranet.jpg ... that's the existing site in ASP but must be converted to ASP.NET to keep up with things. Can anyone hel...

Is having a trigger that inserts a row in Table 'A', when a row in same table is inserted by ADo.Net code?
I want to insert a row for a Global user  in Table 'A' whenever ADO.Net code inserts a Local user row into same table. I recommended using a trigger to implement this functionality, but the DBA was against it, saying that stored proecedures should be used, since triggers are unreliable and slow down the system by placing unecessary locks on the table. Is this true OR the DBA is saying something wrong? My thinking is that Microsoft will never include triggers if they are unreliable and the DBA is just wanting to offload the extra DBA task of triggers to the programmer so that a s...

UPDATE multiple ROWS with different Values with single statement ?- Multiple Rows in subquery- ORA-01427
Hi I'm hoping one of you kind folk can help with this. I want to UPDATE a field of  table with  the results of another query, (sub query), but my sub quesry contains a Group By and so returns multipel rows.UPDATE TABLE_ONE  SET TOTAL_SALES =(SUBQUERY) The Subquery:  Select COUNT(*) from TABLE_TWO where TRANSACTION_TYPE="SALE"  GROUP BY PERSON_ID QUERIES togetherUPDATE TABLE_ONESET TOTAL_SALES=(SELECT Count(*) FROM TABLE_TWO GROUP BY PERSON_ID)  ThisSubquery  return multiple rows and hence teh ORA-01427 error.Can anyone tell me how to loop thr...

Web resources about - how to display multiple rows of a table in single row - asp.net.sql-datasource

Code division multiple access - Wikipedia, the free encyclopedia
Code division multiple access ( CDMA ) is a channel access method used by various radio communication technologies. It should not be confused ...

Sydney Trains missed multiple chances to avoid Edgecliff derailment, says ATSB report
... has highlighted concerns about a focus on a &quot;can-do culture&quot; rather than safety. Sydney Trains staff and senior managers missed multiple ...

Facebook Adds Multiple Matching Options for Custom Audiences
Facebook has added real-time matching across multiple data types to its custom audiences ad-targeting tool. The social network said in a Facebook ...

Multiple explosions kill at least seven near Baghdad
Multiple explosions kill at least seven near Baghdad

Meet the man who made "multiple six figures" in 5 days — playing daily fantasy sports
In the world of daily fantasy sports, there are two types of games: cash games and tournaments. Cash games can be head-to-head against one person, ...

Adult film star James Deen responds to multiple assault allegations
View image - gettyimages.com The following story is not for readers under 18 James Deen is probably the most famous adult film star working ...

Multiple Victims In San Bernadino Mass Shooting; 1-3 Shooters Sought
When is it enough to actually do something? Fuck the NRA. Fuck the Republican party and the right wing hate machine. Those Syrian refugees might ...

The Philadelphia 76ers announced that they suspended Jahlil Okafor—he of the multiple fights outside
The Philadelphia 76ers announced that they suspended Jahlil Okafor—he of the multiple fights outside of bars and one of their only competent ...

Bluestacks now runs multiple Android apps on Windows simultaneously
Bluestacks has come a long way since its original app player in 2011, which was notable for being one of the first methods for running Android ...

Does China Mobile Ltd. (ADR) Have Any Gas After Forming This Multiple Bottom ...
Does China Mobile Ltd. (ADR) Have Any Gas After Forming This Multiple Bottom ... FinancialMagazin.com The stock of China Mobile Ltd. (ADR) ...

Resources last updated: 12/4/2015 11:04:42 PM