Re: Complex query question
- From: "Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@xxxxxxxxxx>
- Date: Wed, 31 Jan 2007 09:27:54 +0100
Check this dynamic pivoting T-SQL solution:
http://weblogs.sqlteam.com/jeffs/articles/5120.aspx.
--
Dejan Sarka
http://www.solidqualitylearning.com/blogs/
"Waterboy" <Waterboy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:73C78A9C-D882-4FE2-9683-B76F7B54C287@xxxxxxxxxxxxxxxx
Hello all,
I have a stored proc that grabs a lot of data (4520) rows per day. I need
to
pivot the data but the columns are not the same everytime its ran, it
depends
on the asset i have selected. i need to covert the data to a csv file,
which
im currently doing in the presentation side, but the data is so large that
looping through it is eating ram up like crazy. so i would like to shift
the
data using sql
Currently the data comes back like this...
___________________________________________________________
Tag | DataValue | Time | Name | Site
|
-----------------------------------------------------------------------------------
st_act_air | 230.3 | 15:00 | Petyo 123 | Peyto
|
st_act_fuel | 72.5 | 15.00 | Petyo 123 |
Peyto
|
------------------------------------------------------------------------------------
I need the data to come back like this:
_________________________________________________________
Site | Name | Time | st_act_air |
st_act_fuel
|
---------------------------------------------------------------------------------
Peyto | Peyto 123 | 15:00 | 230.3 | 72.5
|
--------------------------------------------------------------------------------
im using sql server 2000, any one have any ideas or suggestions?
.
- Follow-Ups:
- Re: Complex query question
- From: Waterboy
- Re: Complex query question
- Prev by Date: Re: Create Table in SQL Server 2005
- Next by Date: Re: Complex query question
- Previous by thread: Re: Create Table in SQL Server 2005
- Next by thread: Re: Complex query question
- Index(es):
Relevant Pages
|
Loading