I want some Moore

Blog about stuff and things and stuff. Mostly about SQL server and .Net
posts - 219, comments - 2287, trackbacks - 33

My Links

Advertisement

News

Hi! My name is 
Mladen Prajdić  I'm from Slovenia and I'm currently working as a .Net (C#) and SQL Server developer.

I also speak at local user group meetings and conferences like SQLBits and NT Conference
Welcome to my blog.
SQL Server MVP

My Books

SQL Server MVP Deep Dives 2
The Red Gate Guide to SQL Server Team based Development Free e-book

My Blog Feed via Email
Follow MladenPrajdic on Twitter


Users Online: who's online

Article Categories

Archives

Post Categories

Cool software

Other Blogs

Other stuff

SQL stuff

March 2005 Blog Posts

Transpose data

There were some quetions in the forums about transposing data without the use of aggregate functions. While building a CSV list is nice sometime that's not what we want. So this is a sproc that does just that. It's nothing complex, it just gets the max number data in groups and builds an SQL statement with that many left joins. create proc spTranspose @TableName varchar(100), @PrimaryCol varchar(100), -- parent column to transposing columns @SecondaryCol varchar(1000) -- CSV string of columns to transpose as select @SecondaryCol = replace(@SecondaryCol,...

posted @ Tuesday, March 15, 2005 10:36 PM | Feedback (2) | Filed Under [ SQL Server ]

Powered by:
Powered By Subtext Powered By ASP.NET