Excel Data Pivot/unpivot To Sql Server 2005 Table

Sep 25, 2007



The following is a SAMPLE data from an excel spreadsheet. This SAMPLE data has many other fields as date. Here I have only used two date columns i.e. 28 Dec 2006 and 29 Dec 2006
This data needs to be exported into sql server 2005 table which has the fields below where I have placed the data into a table.
How can this be done please?

data:

Ref Sector Name 28 Dec 2006 29 Dec 2006
1 Sovereign RUSSIA 05 null 173.21
2 Sovereign RUSSIA 07 102.99 102.22
3 Sovereign RUSSIA 10 114.33 104.63
4 Sovereign RUSSIA 18 115.50 145.50
...

sql server table

create table tblData
(
DataID int,
Ref int,
Sector varchar(20),
Name varchar(20),
Date datetime,
value decimal(6,2)
)

DataID Ref Sector Name Date value
1 1 Sovereign RUSSIA 05 28 Dec 2006 null
2 1 Sovereign RUSSIA 05 29 Dec 2006 173.21
3 2 Sovereign RUSSIA 07 28 Dec 2006 102.99
4 2 Sovereign RUSSIA 07 29 Dec 2006 102.22
5 3 Sovereign RUSSIA 10 28 Dec 2006 114.33
6 3 Sovereign RUSSIA 10 29 Dec 2006 104.63
7 4 Sovereign RUSSIA 18 28 Dec 2006 115.50
8 4 Sovereign RUSSIA 18 29 Dec 2006 145.50
...

View 3 Replies


ADVERTISEMENT

SQL Server 2012 :: Transposing Data Using Pivot And Unpivot

Jun 5, 2015

My table structure is like

col1 col2 col3 col4 col5 col6
abc. def. 3fg. 59j. 567. 596040
abc. def. 3fg. 59j. 567. 596042
abc. def. 3fg. 59j. 567. 596043
abc. def. 3fg. 59j. 567. 596044
edf. ijk. rkl. 1fh. 567. 596045
edf. ijk. rkl. 1fh. 567. 596046
edf. ijk. rkl. 1fh. 567. 596047
edf. ijk. rkl. 1fh. 567. 596048
edf. ijk. rkl. 1fh. 567. 596049

And I am trying to get the above data , gel them ino col 6 by comma separated

col1 col2 col3 col4 col5 col6
abc def 3fg 59j 567 596040,567 596042,567 596043,567 596044
edf ijk rkl 1fh 567 596045,596046,596047,596048,596049

Can I get an example query for this...

View 1 Replies View Related

Power Pivot :: Auto Refresh Excel Table (Not Pivot Table) Using Data Source

Jul 8, 2015

Is it possible to generate automatic refresh of excel 2013 table which displays some table of a power pivot model on file open?? I dont want to use pivottable (which supports this ...)

View 2 Replies View Related

SQL Server Reporting Onto Web Via Excel Pivot Table

Oct 16, 2002

The excel pivot table is very powerful for the user, with dragging and dropping fields at will on the web page, but I can only get it work when run from the web server directly. The data is in SS2000 300,000 rows, get external data in Excel, then publish pivot table as HTM with interactivity.
It seems to look for c:myodbc.dsn in the C: drive of the pc the user is on rather than the server, and I cannot use IP Addressing to relate to the dsn file.
any ideas ?

TIA

Neil.

View 1 Replies View Related

Pivot And Unpivot Example In SSIS

Aug 2, 2007



HI friends i need the pivot an unpivot example

package please send the link with atleast pictures steps


View 3 Replies View Related

T-SQL (SS2K8) :: Pivot And Unpivot In Same Query?

Feb 15, 2014

I have below table and within same query i need pivot and unpivot.

create table #temp(name1 varchar(10),name2 varchar(10),name3 varchar(10),month date,emp1 int,emp2 int,emp3 int,emp4 int)
insert into #temp values ('a','b','c','1-1-2013',1,2,3,4)
insert into #temp values ('a','b','c','1-2-2013',11,20,30,40)
insert into #temp values ('a','c','c','1-1-2013',22,30,80,40)
insert into #temp values ('a','c','c','1-2-2013',28,34,39,30)
select * from #temp

Now i need output in below format

name1,name2,name3,Emp,jan-13,feb-13
a,b,c,emp1,1,11
a,b,c,emp2,2,20
a,b,c,emp3,3,30
a,b,c,emp4,4,40
a,c,c,emp1,22,28
a,c,c,emp2,30,34
a,c,c,emp3,80,39
a,c,c,emp4,40,30

View 4 Replies View Related

Unpivot And Pivot Transformation Issue

Mar 6, 2008



Hi

I have an Issue. Please find the sample of my data source











StudentID
Fee 1
Fee 1 Currency Type
Fee2
Fee 2 Currency Type

1
10
USD
20
INR

2
45
EUR
20
USD


If I need to transform this data, it should be like below Table.










ID
StudentId
FeeType
FeeAmount
CurrencyType

1
1
Fee 1
10
USD

2
1
Fee 2
20
INR

3
2
Fee 1
45
EUR

4
2
Fee 2
20
USD


I have selected columns Fee 1 and Fee 2 in Unpivot Transformation. I set the "FeeAmount" as Destination Column Name and "FeeType" as Pivot Key Value Column Name. I left the Pivot Key Value as is for all the selected columns. So far no issue that I am able to get the Fee Type and Fee Amount columns for my destination table.

But the issue is how to get the Currency Type for each corresponding coulmns? I was not able to get the currency type for each student. I hope you got my point. Please let me know If have further queries and hel me out to find this.

View 5 Replies View Related

T-SQL (SS2K8) :: Join Or Pivot / Unpivot For Mismatch Dates

Jul 31, 2014

I have a table which uses multiple joins to create another table but it turns out that the effective_date which is used in the join to match row together does not work all the time since some of the dates for the effective date column are out of sync meaning records that show data as missing even when the other table contains the data. I try the SQL script below but it returning 6 rows instead of 3–

select t2.[entity_id]
,t2.[effective_date]
,[company_name]
,[last_accounts_date]
,[s_code]
,[s_code_description]
,[ineffective_date]

[code]....

View 3 Replies View Related

Power Pivot :: Force Measure To Be Visible For All Rows In Pivot Table Even When There Is No Data?

Oct 13, 2015

Can I force the following measure to be visible for all rows in a pivot table?

Sales Special Visibility:=IF(
    HASONEVALUE(dimSalesCompanies[SalesCompany])
    ;IF(
        VALUES(dimSalesCompanies[SalesCompany]) = "Sales"
        ;CALCULATE([Sales];ALL(dimSalesCompanies[SalesCompany]))
        ;[Sales]
    )
    ;BLANK()
)

FYI, I also have other measures as well in the pivot table that I don't want to affect.

View 3 Replies View Related

Excel Pivot Table

Jan 12, 2006

Hi,

I have several pivot tables in Excel that access data to a SQL 2000. We install SQL 2005, we change the ODBC from the 2000 server to the 2005 server. Now when we try to run the pivot tables I've got the following message:

"User 'public' does not have permission to run DBCC TRACEON"

Any idea on how to fix this problem?

Thanks,

Arty

View 25 Replies View Related

Excel Pivot Table

Oct 10, 2007

Hi,

Im using Sql server 2000&MS Excel 2003. i've recently moved to Sql server,i was using MS Access.

i've created an odbc connectivity and a View . i've created pivot tables in excel. my intension was once i upload the data into sql server and when i refresh the view/excel pivot, the pivot table should updated automatically with the newly entered data( i used to do the same process in Access).

pls advise me how to update the Excel pivot table.

Rgds
RPU

View 1 Replies View Related

Power Pivot :: Merging Static Excel Data With Dynamic Data?

Aug 19, 2015

I have some data in Excel - sheet1 which would be static.

Now I need to import data from SQL Server (using a query) and Union above static data with this SQL data and later I will have to create PowerPivot table in Sheet2.

Which is suitable option for me to import data from SQL to excel as I see "From SQL Server" option under "Data" and "Power Query" tab as well.

How to merge above SQL data with existing static data?

(SQL Server 2012)

View 6 Replies View Related

Problem With Excel Pivot Table

Jul 23, 2005

I am facing problem like;We generate reports thru Excel Pivot table. The data is coming from salescube. Let?s assume that there are 2 products A and B. The user wants tofilter for each product and view ?stock in hand? and ?total sales? forparticular month (as two columns).From the Pivot table filtering, when we choose product A and month ?Jan?,it is showing values for ?stock in hand? and ?total sales? columns for thatmonth.But when we choose product B and month ?Jan?, it is only showing ?stock inhand? value and the ?total sales? column was suppressed/unseen. We knowthat there is no sales transaction for ?Jan? month. But we still want toshow the column title even if there are no records in the database / cube.I am not using any scripting, this pivot table was generated just thruPivot table wizard.Any way to achieve this, please advise me.Advanced thanks for u r help.--Message posted via http://www.sqlmonster.com

View 1 Replies View Related

SQL Server 2008 :: Pivot Data In Table?

Jun 24, 2015

MyTable has the following data (Just a sample)

parent | NAme | Checked | contactmethod|Check2 | Other
974198 | Employment | true | Face to Face | true | null
974224 | Other | true | Face to Face | true | skills
974224 | Other | true | Contact | true | skills

I'd like to pivot on "parent"

In a perfect world I'd like to see output like

974198 | Employment | true | Face to Face | true | null

974224 | Other | true | Face to Face, Collateral Contact | true | skills

If there are more than one name or contactmethod for the same parent then they would be strung along with commas

View 1 Replies View Related

Export Dynamic Pivot Table To Excel

Feb 26, 2015

I know that this is an Excel question, but I guess it is much more likely that an SQL person using dynamic pivot tables had stepped on this, rather than any advanced Excel user.

I am exporting a dynamic pivot table to Excel through a Stored Procedure. If the Stored Procedure that executes the dynamic pivot table returns 7 columns in one run, and 4 columns in the following update, then I have 3 orphaned columns that are still displayed in the spreadsheet. There isn't any content related to them, but the empty columns with their headers are bothering enough.

I've been trying to play with the data connection properties, but nothing deletes unused columns from former data executions.

View 1 Replies View Related

Excel 2007 PIVOT As Data Source

Jan 18, 2008

Hi,

We have a excel 2007 file with a Pivot Table in it. We would like to use the same as data source (But all the source fields as it comes for Pivot). The key issue is that the data to the pivot is from a connection and points to DB - but there is no access to DB. So the Excel is static to us with a PIVOT in it.

Is there a way to get all the data that is avaialble as a source for pivot.

Ex. The select query has co1,co2....co 11 from xxxxx
whereas the PIVot HAS ONLY cO1, CO2 AS ROW, CO3,CO4 AS COL, CO5 AS VALUE AND CO6,CO7 AS FILTER AND OTHERS MISSED OUT IN PIVOT.

THe SSIS as such provide Excel 2007 access to Access OLE DB driver with Excel 12 setting in advanced tab. But not sure whether we can give the range (or) a way around ot get all the data as available in excel regardless of what is used only in the pivot.

Regards,
kart

View 4 Replies View Related

Drillthrough An Excel Pivot Table Into Analysis Services ?

Oct 5, 2005

Wonder if you could help me ?

I have set up a cube running under MSSQL Server 2000 Analysis services and have created reports in Excel 2002 using pivot tables and linking into the cube as an external data source.

The pivottable works fine and I can slice / dice as usual, the only thing that doesnt work is the drill through into AS. I receive and error message saying "Cannot show detail data for that selection...".

Now I know that the drill through works, as when I create a report using the Analsyis Services Excel Add Inthe drill through works fine, its just how do I get it working using the pivot tables ?

fyi - the reason I dont want to use the Analsyis Services Excel Add In for all the reports is because I have to deploy this to XX number of users, who wont have admin rights on their machines etc etc....

Is there any VB that I could use to perform this drill through and return the results.....or easier ??


Thanks very much

Mark

View 3 Replies View Related

Power Pivot :: Downloading Table For Excel 2010

Nov 18, 2015

have just implement Microsoft Dynamics NAV. and I'm trying to learn how to use this Excellent tool powerpivot add on, But when I'm trying to connect it to any SQL table that support Dynamics NAV I have an error message while downloading the table :"do not have enough memory or I should use Excel 64 bits instead 32 bits".when I check CPU memory Utilization we are just using less tha 20%. I'm working on a remote server and the using Excel 2010.

View 3 Replies View Related

Creating Pivot Table In Excel Using Activex Script

Mar 13, 2008



I am trying to create a pivot table in excel using Activex scripting but i am facing some problems in doing so, below is the code that I have written
The line of the code where i am encountering error is highlighted in RED

Set ActiveWorkBook = oExcel.Workbooks.Open (sFile)
Set oSheet = ActiveWorkBook.WorkSheets(1)
oSheet.Range("A1:T1").Font.Bold = True
oSheet.Cells.Select
oSheet.Cells.EntireColumn.AutoFit
oSheet.Range("A1").Select
oSheet.Name = "Data_" & strName


Set oSheet = ActiveWorkBook.WorkSheets(2)
oSheet.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= "Sheet1!A$:T$").CreatePivotTable TableDestination:=Range("A3"), TableName :="PivotTable2"
oSheet.PivotTables("PivotTable2").SmallGrid = False
With oSheet.PivotTables("PivotTable2").PivotFields("Supervisor")
.Orientation = xlRowField
.Position = 1
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Operator")
.Orientation = xlRowField
.Position = 2
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Tag")
.Orientation = xlDataField
.Position = 1
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Dept")
.Orientation = xlPageField
.Position = 1
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Branch")
.Orientation = xlPageField
.Position = 2
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Location")
.Orientation = xlPageField
.Position = 3
End With
With oSheet.PivotTables("PivotTable2").PivotFields("Type")
.Orientation = xlPageField
.Position = 4
End With
oSheet.PivotTables("PivotTable2").RefreshTable
ActiveWorkBook.WorkSheets(3).Delete
'ActiveWorkBook.WorkSheets(2).Delete
oExcel.ActiveWorkBook.Save

'With ActiveWorkBook
' .SaveAs sFile
' .save
'End With

oExcel.quit

View 3 Replies View Related

SQL Server 2012 :: Using Cross Apply To UNPIVOT Data

Jan 15, 2014

I was reading Kenneth Fisher's and Dwain Camps' articles on unpivoting using cross apply... And I can actually get them to work....

CREATE TABLE #TxCycle(
Cycle INT NOT NULL,
PatientID INT NOT NULL,
ALOPECIA TINYINT,
Causality1 TINYINT,
Relatedness1 TINYINT,

[Code] ....

The one thing I was wondering was this: how do I extract the symptom names from the field list without knowing them all beforehand? Dwain does this

-- DDL and sample data for UNPIVOT Example 2
CREATE TABLE #Suppliers
(ID INT, Product VARCHAR(500)
,Supplier1 VARCHAR(500), Supplier2 VARCHAR(500), Supplier3 VARCHAR(500)
,City1 VARCHAR(500), City2 VARCHAR(500), City3 VARCHAR(500))

Can this be adapted if you don't know all the column names beforehand? (Likely not). Back in the dark ages, when I was working on a database like this, it was in Access, and I could loop over the fields collection and evaluate each field name. (Yes, I know you're not supposed to store information in field names, but I inherited that mess!)

View 7 Replies View Related

Power Pivot :: Pivot Table Loses Text Wrapping For Text Data Upon Refresh

Apr 29, 2015

I have a pivot table that connects to our data warehouse via a PowerPivot connection.  The data contains a bunch of comment fields that are each between 250 and 500 characters.  I've set the columns in this pivot table to have the 'Wrap Text' set to true so that the user experience is better, and they can view these comment fields more clearly.

However, whenever I refresh the data, the text wrapping un-sets itself.  Interestingly, the 'Wrap Text' setting is still enabled, but I have to go and click it, then click it again to actually wrap the text.  This is very burdensome on the user, and degrading the experience.

Any way to make this text wrapping stick so that I don't have to re-set it every time I refresh the data?

View 2 Replies View Related

Power Pivot :: How To Change / Edit Excel Workbook Data Connection String

May 28, 2014

One of my excel 2013 power pivot report was migrated from old server to new server after migration i changed the excel power pivot connection string to connect with new server but the workbook connections is still taking the old connection string of old server and there is no option of changing workbook connection string .

I am able to edit the powerpivot connection but workbook connections are not getting updated they are still taking old server connection string.

View 12 Replies View Related

Analysis :: SSAS Tabular Small Database Fails In Excel Pivot Table Because Of Memory Shortage?

May 7, 2015

I have a very small SSAS database with around 35 Mb. I opened it on Excel 32 bits and started dragging fields to a pivot table and it started failing with memory errors. The behavior on the SSAS server was that memory started growing very fast until 8 GB (vm memory total) and then the error is reported in excel.

What might be the issue in such a small database? I would understand in a big database, but not on this one.

View 13 Replies View Related

How To Import Data From Excel To Sql Server 2005

Apr 3, 2008

hi all,
        how to import data from excel to sql server 2005 using asp.net 2.0 and c#
 
 Ashok

View 3 Replies View Related

Imorting Excel 07 Data Into SQL Server 2005

Dec 13, 2006

I have been trying to use the dtswizard.exe in SQL Server 2005 to import Excel 07 spreadsheets with no success.

Any idea how this can be done?

As a work around I have been importing the Excel 07 data into Access 07 and saving the database as the older mdb extension, THEN importing the mdb file into SQL Server 2005. Seems silly though.

View 4 Replies View Related

Can You Unpivot On Multiple Keys With The Unpivot Transform

Oct 17, 2006

Hi all,

I have more than 1 set of columns I'm trying to normalize, can an unpivot transform handle 2 unpivots around DIFFERENT keys in the same transform?

If not, would the suggestion be unpivot into temp tables for whatever needs normalizing, than run an update query to generate the row that is desired?

Thanks in advance.


Mark

View 2 Replies View Related

Join A Excel Sheet And Sql Server 2005 Table

Sep 7, 2007

Hi,

i'm making a merge join on a excel source whit a Sql Server 2005 (OLE DB). In the SQL table i have a select over AdventureWorks.Sales.SalesOrderDetail , in a excel file i pasted the information of the AdventureWorks.Production.Product
when i'm doing the merge join of this tables,i hope obtain 121.000 registries, but when the work is finished I only have 27 registries.
So i must configure buffer properties in the merge?

JULIAN CASTIBLANCO P

View 3 Replies View Related

Import Excel Data To A Sql Server Table

Sep 11, 2007

Hi,

I need to import data from more than 10 excels having the same format in to a single sql server table.

I tried to use

INSERT INTO MyTempTable
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 11.0;Database=C:Book1.xls', [Sheet1$])

but got the below error
Ad hoc access to OLE DB provider 'Microsoft.Jet.OLEDB.4.0' has been denied. You must access this provider through a linked server.

If DTS package is used then I am not sure how I can place 10 excels at a time so that they can be picked one by one and data is imported in to table.

Please help.

Thanks,
Vimalraj

View 1 Replies View Related

Importing Excel Data Into New Table In MS SQL Server

Jul 10, 2007

I have installed SQL Server Managemert Server Express .... I am wondering how to import data from an excel spreadsheet?



.. Silent Running

View 3 Replies View Related

Importing Excel Data Into SQL Server 2005 With A Twist!

Jun 11, 2007

Hi,
I would like to import an Excel spreadsheet into SQL Server 2005. I can do this quite easily using the Import/Export wizard, and have each row in the spreadsheet transfer to a new row in the database table.
However, I want to import the first few columns of the spreadsheet row into one table (called Products), but put the remaining columns into a related, three-column table, called Product_Details. In the Product_Details table, one column would hold the spreadsheet column value, the other column would be a FK integer value linked to the PK in the Products table, and the third column the primary key as normal.
So, somehow, I would need to get hold of the primary key value when the first spreadsheet columns are inserted into the Products table and then insert the remaining columns into the Product_Details table with two values per row - one value being the spreadsheet cell value, the second being the primary key of the new product in the Products table.
TIA,
Graham.

View 1 Replies View Related

Importing Data From Excel 2003 To Sql Server 2005

Sep 3, 2007

Hi all. I want to export data from excel 2003 to sql server 2005. I am using the following script:
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO
Insert into Pamphlet
Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:Pamphlet.xls;HDR=YES', 'SELECT * FROM [Sheet3$]')
But it is giving the following error:
Msg 7399, Level 16, State 1, Line 2
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 2
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
The above script is working fine with Excel 2002 but not with 2003. Can someone please provide me exact script of importing data from excel 2003 to sql server 2005. I have also tried the Linked server option but it is still giving the same error.
Please help me.  
 
 

View 1 Replies View Related

How Can I Import Data From Excel To SQL Server 2005 Express

Nov 29, 2007

I would like to import an Excel file into my SQL Server 2005 Express db. I'm using SQL Server Management Studio Express to manage my db.
I appreciate your suggestions,

View 3 Replies View Related

How To Import MS Excel Data Into SQL Server 2005 Express Ed.

Mar 22, 2006

I am using SQL Server 2005 Express Edition for testing and developping my website. How can i import MS Excel Data into a SQL Server table?

View 2 Replies View Related







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