Tangra Inc.
  • HOME
  • SERVICES
  • PRODUCTS
  • BLOG
  • CONTACT US
  • Search
  • Menu Menu
  • The Wisdom of the Geeks

    Random Ramblings About Technology

Plamen Ratchev

Unpivoting Multiple Columns

February 28, 2009/20 Comments/in SQL Server/by Plamen Ratchev

Unpivoting is the process of normalizing data. In earlier post I discussed unpivoting a single column. This demonstration is to show how to unpivot multiple columns. The task is to normalize the following denormalized data, which represents product sales volumes by quarter: product_nbr qtr1   sales_qtr1  qtr2   sales_qtr2  qtr3   sales_qtr3  qtr4   sales_qtr4———– —— ———– —— ———– —— ———– —— ———–1           2008Q1 100         2008Q2 20          2008Q3 15          2008Q4 102           2008Q1 80          2008Q2 15          2008Q3 20          2008Q4 103           2008Q1 70          2008Q2 5           2008Q3 10          2008Q4 15 Normalized data set should look like this: product_nbr qtr    sales———– —— ———–1           2008Q1 1001           2008Q2 201           2008Q3 151           2008Q4 102           2008Q1 802           2008Q2 152           2008Q3 202           2008Q4 103           2008Q1 703           2008Q2 53           2008Q3 103           2008Q4 15 The first method uses […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Plamen Ratchev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Plamen Ratchev2009-02-28 17:00:002017-02-11 07:36:40Unpivoting Multiple Columns
Plamen Ratchev

Pivoting on Multiple Columns

January 31, 2009/33 Comments/in SQL Server/by Plamen Ratchev

Pivoting data on more than one column is not a common request. But there are times when it is a very useful technique for reporting purposes. Here is one example to demonstrate different methods to handle that. The goal is to report product data by pivoting columns with value and quantity for each product based […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Plamen Ratchev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Plamen Ratchev2009-01-31 19:00:002017-02-11 07:37:16Pivoting on Multiple Columns
Plamen Ratchev

Dynamic Pivoting

December 24, 2008/0 Comments/in SQL Server/by Plamen Ratchev

SQL Server 2005 added the PIVOT operator which makes creating cross-tab queries very easy. However, as of this writing none of the SQL Server versions has built-in support for dynamic pivoting. The PIVOT operator only provides basic pivoting capabilities on a static list of values. In practice it is very often needed to perform this […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Plamen Ratchev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Plamen Ratchev2008-12-24 16:33:002017-02-07 15:28:48Dynamic Pivoting
Peter Staev

How to extract IDENTITY_SEED and IDENTITY_INCREMENT from autoval column in syscolumns

November 23, 2008/0 Comments/in SQL Server/by Peter Staev

There are many hints on the internet that in the autoval column in the system table syscolumns in MS SQL Server 2000 it is stored the identity seed and identity increment values for columns that have been set as identity. Problem is there are little clues on how to extract those values from that column, […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Peter Staev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Peter Staev2008-11-23 05:31:002017-02-06 17:25:23How to extract IDENTITY_SEED and IDENTITY_INCREMENT from autoval column in syscolumns
Peter Staev

Simple Tile Horizontally / Tile Vertically functionality in WPF

November 23, 2008/0 Comments/in .NET Framework, WPF, XAML/by Peter Staev

Here is the main idea: We will have a grid with three rows and three columns. The middle column/row will be used to store the GridSplitter that will allow us to resize columns/rows once we are in one of the tile modes. So basically when we are in Tile Horizontally we will span the textboxes […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Peter Staev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Peter Staev2008-11-23 05:07:002017-02-06 17:28:05Simple Tile Horizontally / Tile Vertically functionality in WPF
Plamen Ratchev

Import XML File to SQL Table

November 14, 2008/100 Comments/in SQL Server, XML/by Plamen Ratchev

Here is a brief example of importing an XML file into SQL Server table. This is accomplished by using the BULK option of OPENROWSET to load the file, and then utilizing the XQuery capabilities of SQL Server to parse the XML to normalized table format. This example requires SQL server 2005 or SQL Server 2008. […]

Read more
https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png 0 0 Plamen Ratchev https://www.tangrainc.com/wp-content/uploads/2017/02/tangra-logo3.png Plamen Ratchev2008-11-14 21:10:002017-02-11 07:37:55Import XML File to SQL Table
Page 5 of 17«‹34567›»

Categories

  • .NET Framework
  • best practices
  • Binding
  • books
  • CLR
  • Cryptography
  • Custom User Controls
  • Excel
  • LINQ
  • mobile
  • NativeScript
  • obfuscation
  • PASS
  • Security
  • Silverlight
  • SQL Server
  • sql server compact
  • SQLRally
  • SQLSaturday
  • WCF
  • WPF
  • XAML
  • XML

Archives

  • August 2018
  • June 2017
  • March 2017
  • February 2017
  • April 2016
  • March 2016
  • October 2011
  • May 2011
  • February 2011
  • January 2011
  • October 2010
  • August 2010
  • July 2010
  • February 2010
  • January 2010
  • August 2009
  • June 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • January 2007

SITE MAP

  • HOME
  • SERVICES
  • PRODUCTS
  • BLOG
  • CONTACT US
  • TERMS
  • PRIVACY

SEARCH

Copyright © 2025 Tangra Inc.
Scroll to top