Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Query please
Message
De
04/05/2011 10:02:24
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Application:
Desktop
Divers
Thread ID:
01509404
Message ID:
01509407
Vues:
31
>>>I have a table that will have a variable number of records. This is a Bed table. The facility may have 1-30 (or more) beds. I am wanting to create a stored procedure that returns a table, with the beds as columns, and each row will represent a day. So when passed the date say of 5/1/2011, they query would return a recordset that had a column for the date and then 1 column for each bed.
>>>
>>>
>>>DATE              BED1         BED2       BED3       BED4
>>>05/01/2011         
>>>05/02/2011
>>>05/03/2011
>>>...
>>>05/31/2011
>>>
>>>
>>>The bed table simply has the BedID,BedDesc, IsActive (bit) as fields.
>>>
>>>Thanks for any suggestions
>>>
>>>Kirk.
>>
>>Check http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6216
>>or google:dynamic pivoting in sql server 2000
>
>Hi Boris,
>
>George Mastros has a blog on Pivoting in SQL 2000, although not dynamic. It's easy to turn it to dynamic, of course:
>
>http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/understanding-sql-server-2000-pivot
>
>BTW, the usual answer is to perform transformation on the client (in the Reporting tool), not in T-SQL.

Why is that the usual answer ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform