SQL Server :: Pivot / Transpose Sql Data?

Aug 1, 2010

I have a table with the following structure and Values:

ID | Property | Value

-----------------------------

1 | FirstName| ABC

1 | LastName| XYZ

I want to get results in the following format:

ID | FirstName | LastName

----------------------------------

1 | ABC | XYZ

Please suggest a way to get the desired result.

View 1 Replies


Similar Messages:

SQL Server :: Transpose Rows To Columns In Datatable

Feb 23, 2011

This is datat table format :

TagName Timestamp Value
Tag1 21-2-2011 12
Tag1 22-2-2011 1
Tag2 21-2-2011 13

I want in this Format

TimeStamp Tag1 Tag2
21-2-2011 12 13
22-2-2011 1 0

View 6 Replies

SQL Server :: Transpose A Column In To Rows Based On Special Character

Dec 29, 2010

i have table a with fourcolumns and more which need not be considered i would like the fourth column which has a special charcater ^ within it to act as row seperator such tht the values of 1,2,3 are comon for ALL THE ROWS BASED ON THE SPECIAL CHARACTER.

View 3 Replies

Forms Data Controls :: Transpose Datatable Row To Column?

Feb 24, 2011

for below i dont want to use sql Query bcz data is not coming from sql/oracle database.

its comeing from propertary database and data is in datatable .


This is datat table format :

[code]....

View 1 Replies

Forms Data Controls :: Transpose Columns To Rows In C#?

Jan 7, 2011

Gridview-

Id Name Initial
1 abc A
2 def B
3 ghi C

After transposing,I want it to be like this-

Id 1 2 3
Name abc def ghi
Initial A B C

how to transpose in c# with code and if it is made as a function then how can I call it?I'm new to c#.

View 1 Replies

SQL Server :: Pivot Columns For One Row Like So?

Mar 7, 2011

I'm not even sure if I'm using the correct terminology of "Pivot". I've seen several examples of pivoting in SQL but I have not found anything like I am trying to do.Can someone tell me if it's possible to pivot columns for one row like so?:

[code]...

View 2 Replies

SQL Server :: Looking For PIVOT Select Statement?

Jul 29, 2010

i have the table like

TId DG rating DGMake DGCapacity
1 1 4 DG1 1X1
1 2 5 DG2 2X2
1 3 3 DG3 3X3


i need the output like this.

TId DG1 DG2 DG3 DG1Rating DG2Rating DG3Rating DG1Make DG2Make DG3Make DG1Capacity DG2Capaciy DG3Capacity

1 1 2 3 4 5 3 DG1 DG2 DG3 1X1 2X2 3X3

View 1 Replies

DataSource Controls :: Pivot In Sql Server

Feb 26, 2010

I want this result

Id
Name
Service [code].....

View 3 Replies

SQL Server :: How To Merge Pivot Result With Other Columns

Feb 11, 2011

I got the following table:

Lane Bin1 Bin2 Bin3
1 B11 B21 B31
2 B21 B22 B23
3 B31 B32 B33

How can i change the layout to

Bin1(Lane1) Bin1(Lane2) Bin1(Lane3) Bin2(Lane1) Bin2(Lane2) Bin2(Lane3) Bin3(Lane1) Bin3(Lane2) Bin3(Lane3)
B11 B21 B31 B21 B22 B23 B31 B32 B33

I tried using pivot, but cant get it.

View 11 Replies

SQL Server :: How To Pass Parameter To PIVOT Query

Feb 14, 2011

I tried to develop a dynamic pivot query with following code to avoid hard coding. I can got the 'Q1, Q2, Q3, Q4' dynamically and assigned to @(@quarter. But it cannot be passed to the pivot query.

[Code]....

View 7 Replies

SQL Server :: Retrieving Users From Mapping / Pivot Table?

Sep 9, 2010

I have three tables.

CustomProfile
UserID (pk)
DisplayName
CompanyID
Teams
TeamRecordID (Pk)
TeamID
CompanyID
EmployeesInTeams
UserID
TeamID

I want to assign employees to teams via a gridview control with a templated checkbox.

I have a dropdownlist control to select the TeamID.

I am having problems with the select statement.

The gridview needs to select employees that are not assigned to any teams as well as assigned to other teams. An employee can be assigned to many teams.

What I have been trying is:

cp.UserID, cp.DisplayName, et.TeamIntID, cp.CompanyID

View 32 Replies

SQL Server :: Unable To Pass Dynamic Dates To Stored Procedure With Pivot

Oct 4, 2010

I am unable to date as dynamic parameter to stored procdure with pivot.i am getting

error

Msg 8114, Level 16, State 1, Procedure Sample, Line 3 Error converting data type nvarchar to datetime. Msg 473, Level 16, State 1, Procedure Sample, Line 3 The incorrect value "@date1" is supplied in the PIVOT operator.

below is my stored procedure

[code].....

View 4 Replies

DataSource Controls :: How To Write Query Using Pivot Logic In Sql Server 2005

Jan 7, 2010

i have a table for customer forecast which contains customer, week number and quantit as columns. now i need to write query and list the week as column for each customer and each cell should have a quantity. how to write query for this using pivot logic. i dont want to use cursor.

View 3 Replies

SQL Server :: Pivot Query / Unable To Pass Dates As Parameters To Storeprocedure?

Oct 4, 2010

I am using following pivot query but not getting result as single row getting as 4 rows.

One more problem i am unable to pass dates as parameters to storeprocedure something like this

select [@date] .

SELECT 'Forecasted' AS HeadCount,
[8/1/2010], [8/8/2010], [8/15/2010], [8/22/2010]
FROM
(SELECT *
FROM TblEmpCount) AS SourceTable
PIVOT
(
SUM(EmpCount)
FOR StartDate IN ([8/1/2010], [8/8/2010], [8/15/2010], [8/22/2010])
) AS PivotTable;

I am getting result as 4 rows but i want result in single row like this

HeadCount 8/1/2010 8/8/2010 8/15/2010 8/222/2010

Forecasted 191 182 176 169

View 2 Replies

SQL Server :: Dynamic Pivot In Stored Procedure / Error - Incorrect Syntax Near '+@columns+'

Nov 2, 2010

i have a dynamic pivot table which has a parameter passed in stored procdure

i have temp table to store columns in it to be dynamic and also a parameter

but this script make me go mad

colud you find me the error Inncorrect syntax near '+@columns+'Item_Group2 table structure is ID,Name,Group1_ID this is script

[Code]....

View 6 Replies

Get Xml Html After Transpose And Databind()?

Jun 9, 2010

I have some code that uses xsl and xml. The Xml control is on the design page. The xml control id is xmlApplication The xmlstring is generated and xsl has the format with all the tables and cells etc. Here is a part of thecode of a page which generates the final product which shows the xml in a certain format.

xmlApplication.Document = xmlDoc;
xmlApplication.Transform = transApp;
xmlApplication.DataBind();

I am guessing after xmlApplication.Databind(), xmlApplication will be converted into something that can be put inside. Is it possible to grab as a string?

View 1 Replies

Forms Data Controls :: How To Dispaly Pivot Data

Aug 19, 2010

I would like to display the results of my pivot stored procedure. What control will allow this?

View 2 Replies

Forms Data Controls :: Display An Excel like Pivot Table In .Net Web?

Apr 8, 2010

I need to display an Excel like Pivot table in ASP.Net web.I knew there is OWC Pivot table but it looks really ugly and not like Excel's.
Is there any control out there or we can create one of our own ?

View 3 Replies

Data Controls :: Result In Pivot Table Shown To Gridview

Aug 21, 2012

I have a doubt and i am sending you the details  below, what i want to display in Gridview.

below i am describing the sql Table Structure.

Original Table Structure.

ID                Date             TimeLogged(Hrs)        UserName

1             10/8/2012               5.50                          Bubai
2             11/8/2012               2.30                          Bubai
3             10/8/2012               3.30                          Bhanu
4             11/8/2012               7.30                          Bhanu

I want result like below. User Name should be dynamic. May be lot of users. User name will come from Database table.

i want to show details in Gridview(Front End).

Date                    Bubai               Bhanu                    Total

10/8/2012              5.30                   3                         8. 30
11/8/2012              2.30                  7.30                       10

  Total                   8                    10.30                  18.30
 
I have a doubt and i am sending you the details below, what i want to display in Gridview. below i am describing the sql Table Structure.Original Table Structure.

ID Date TimeLogged(Hrs) UserName
1 10/8/2012 5.50 Bubai
2 11/8/2012 2.30 Bubai
3 10/8/2012 3.30 Bhanu
4 11/8/2012 7.30 Bhanu

I want result like below. User Name should be dynamic. May be lot of users. User name will come from Database table. i want to show details in Gridview(Front End).

Date Bubai Bhanu Total
10/8/2012 5.30 3 8. 30
11/8/2012 2.30 7.30 10

Total 8 10.30 18.30

View 1 Replies

Forms Data Controls :: Display The Attendance In Datewise Using Pivot Table?

Jun 3, 2010

I'am developing a attendance software of employees with visual studio 2005 and sql server 2005, in which i have to display the attendance in a gridview withname and date as follows,

NAME (Date)1 2 3 4 5 6 7 8 9 10 .... ... 31
RAM P A P P P A
P- Present
A- Absent

View 5 Replies

Forms Data Controls :: Totaling Gridview In Footer From Pivot Table?

Jan 6, 2011

I am bringing back a matrix from using a pivot table and displaying the results in a gridview. Here is the code to my gridview

[Code]....

This works fine but I want to total each column but they are dynamic so I don't know how many columns there will be. So it will look something like below:

East Midlands
0
0
0
0
0
0
0
0
0
North East
0
0
0
0
0
0
0
0
0
North London
0
0
0
0
0
0
0
0
0
North West
0
0
0
0
0
0
0
0
0
ROI
0
0
0
0
0
0
0
0
0
Scotland & NI
0
0
0
0
0
0
0
0
0
South East
1
1
0
0
0
0
0
0
0
South London
0
0
0
0
0
0
0
0
0
South Wales & West
0
0
0
0
0
0
0
0
0
West Midlands
0
0
0
0
0
0
0
0
0
Total
1
1
0
0
0
0
0
0

I am struggling to get the column totals in the footer. I have the code below which just brings back zero each time and if i move the Dim total as integer = 0 to the top as a global variable I get 54 in each of the total columns?

[Code]....

View 2 Replies

Data Controls :: Bind Repeater With Stored Procedure Using PIVOT Method

Apr 27, 2016

Need to bind repeater using PIVOT method via stored procedure.

View 1 Replies

Data Controls :: Populate Multiple Column Values In DropDownList Using Pivot

Jan 29, 2014

I have one database in which student enroll no with his sem is stored . I want that if i enter stud enroll no then in dropdown list all the sem related to that stud should come. My database 

Stud enroll no        sem1           sem2            sem3           sem4

        1                   July 2013     Jan 2014      July 2014     Jan 2015
        2                   Feb 2013     Aug 2014     Feb 2014     Aug 2015 
        3                  July 2012     Jan 2013     July 2013     Jan 2014

View 1 Replies

How To Change Output Format From Pivot Solution

Oct 2, 2010

I am using following pivot to get the result but getting error

[Code]....

When i use select * from tableName i am getting following data

StartDate Headcount
08/01/2010 182
08/08/2010 176
08/15/2010 198
08/15/2010 192


I want data like this

08/01/2010 08/08/2010 08/15/2010 08/22/2010
182 176 198 192

View 2 Replies

DataSource Controls :: How To Monthly Pivot In A Grid

Feb 21, 2010

Is it possible to get a Activity, year, monthly pivot from a table for a clientID? And I need to show it in a control (grid or ?)

My table has tblActivities (ActivityID, ActivityDate, ClientID)

And I have a lookup tblLookupActivities (ActID, Activity)

I need something that looks like:

Activity | Year | Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Nov|Dec|

CPR | 2007 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 3 |
Jump| 2008 | 2 | 1 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 1 | 3 |

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved