tsql - How can I do a dynamic pivot in SQL Server 2000 -


i want write sql statement uses pivot in sql server 2000. pivot keyword not available in sql server 2000 found examples use case statement requires know column names beforehand won't. how do pivot dynamically generates column names data has available it?

we create sql commands case statements our application , fire them @ database (any database, not sql server). first determine number of pivot columns , names using 1 query, results generate next query. first query determine columns looks like:

select distinct myfield mytable 

then use values in result construct sql command case statement generated each value.

we wanted databasebase agnostic solution processing outside database i'm sure same in stored procedure withing sql server itself.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -