Sunday, March 11, 2012

Create Pivot Table In SQL 2005 HELP ME....

Hi all, i have this problem
im using the newest SQL 2005 and i need to create a pivot table, and my
problem is
my pivot table is something like this
COL1 COL2, COL3 , ... COLN
ROW1 1 3 0 .......
ROW2 4 2 4 . ............
ROW3 23 23 34 .........
..... .....................................
ROWN ..............................
how can i do this in SQL 2005 ? is It possible '
thsk
JSBPivot (or Unpivot) Your Data
http://www.windowsitpro.com/SQLServ...901/pg/1/1.html
David Portas
SQL Server MVP
--|||Check out,
http://vadivel.blogspot.com/2004/12...el.blogspot.com
http://thinkingms.com/vadivel
"Jo?o Santa Bárbara" wrote:

> Hi all, i have this problem
> i′m using the newest SQL 2005 and i need to create a pivot table, and my
> problem is
> my pivot table is something like this
> COL1 COL2, COL3 , ... COLN
> ROW1 1 3 0 .......
> ROW2 4 2 4 . ............
> ROW3 23 23 34 .........
> ...... .....................................
> ROWN ..............................
> how can i do this in SQL 2005 ? is It possible '
> thsk
> JSB
>
>|||thks for your sample.
but it is no good for me ..
the problem is, i dont have the number of columns could be 10 could be 100
..
and the pivot statement requires that explicity we say the columns for
pivoting.
thsk
JSB
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1131363888.340562.246280@.g43g2000cwa.googlegroups.com...
> Pivot (or Unpivot) Your Data
> http://www.windowsitpro.com/SQLServ...901/pg/1/1.html
> --
> David Portas
> SQL Server MVP
> --
>|||> the problem is, i dont have the number of columns could be 10 could be
> 100 ..
> and the pivot statement requires that explicity we say the columns for
> pivoting.
That's right. If you don't know the number of columns, you won't be able to
use PIVOT. See the links from http://www.aspfaq.com/2462 ...|||Jo=E3o Santa B=E1rbara wrote:
> thks for your sample.
> but it is no good for me ..
> the problem is, i don=B4t have the number of columns could be 10 could b=
e 100
> ..
> and the pivot statement requires that explicity we say the columns for
> pivoting.
> thsk
> JSB
>
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
> news:1131363888.340562.246280@.g43g2000cwa.googlegroups.com...
tml
Then you can't use static SQL because a query always returns a fixed
number of columns. That's why the best solution is usually to do this
in your reporting tool / presentation app.
--=20
David Portas
SQL Server MVP
--|||Try out the RAC utility @.
www.rac4sql.net
"Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
news:upukG844FHA.252@.TK2MSFTNGP15.phx.gbl...
> Hi all, i have this problem
> im using the newest SQL 2005 and i need to create a pivot table, and my
> problem is
> my pivot table is something like this
> COL1 COL2, COL3 , ... COLN
> ROW1 1 3 0 .......
> ROW2 4 2 4 . ............
> ROW3 23 23 34 .........
> ..... .....................................
> ROWN ..............................
> how can i do this in SQL 2005 ? is It possible '
> thsk
> JSB
>
>

No comments:

Post a Comment