# Save data into SQL table by Pivoting the data

**URL:** <https://forum.inductiveautomation.com/t/save-data-into-sql-table-by-pivoting-the-data/24117>\
**Category:** Ignition\
**Tags:** database\
**Created:** [April 13, 2019, 12:51pm UTC](https://forum.inductiveautomation.com/t/save-data-into-sql-table-by-pivoting-the-data/24117 "2019-04-13T12:51:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saurabhambildhuke08](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@saurabhambildhuke08](https://forum.inductiveautomation.com/u/saurabhambildhuke08)\
**Post date:** [April 13, 2019, 12:51pm UTC](https://forum.inductiveautomation.com/t/save-data-into-sql-table-by-pivoting-the-data/24117/1 "2019-04-13T12:51:25Z")

</div>

Hii ,  
I was doing some SQL scripting work and stuck somewhere. I have 16 Pens in my easy chart and I am saving that data in sql. I am only saving 4 columns out of the 21 Columns of tagPens.

So what i want is the data which i am saving need to transpose in a manner that my row will get saved as column. for ex:- I have “name” column in easy chart tagpens which has 16 rows so i need the 16 rows to be as my column 1 row when i am saving that data in SQL. similar for the tag\_path column and color column. I am attaching image which shows my concern.

And the next thing is I need to create a header for this table as Group, Name1 - Name16, Path1-Path16 and Color1-Color16

 ![Data%20to%20saved%20in%20SQL](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/43e490db9679b6f336ca7a8dc819733fffea0b75.png) ![present%20data](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/981d7a598292e41cd9ebf68071daacef430e66a5.png)
