Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2004, 09:12 PM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Dhodie
Default Crosstab query in SQL Server

Hi!

Anybody who knows how to create crosstab query in SQL Server. I created a sample crosstab query in MS Access 2000 and I tested the same generated SQL statement in Query Analyzer but it fails. Any help?

-Dhodie

 
Old June 10th, 2004, 09:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am not sure what causes the failure, as you havent posted your code or not given any hint about what you were trying to achieve. I am not sure, if you were trying to achieve that in SQL server ot MS Access.

Still you can take a look at this page.
Cross-Tab Reports

Hope that helps.
Cheers!

_________________________
-Vijay G
Strive for Perfection
 
Old June 10th, 2004, 09:52 PM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Dhodie
Default

Hi Vijay!

Thanks for the immediate response.

Anyway, I have the following SQL statement generated by MS Access 2K.

TRANSFORM Sum(dbo_btBatchDailyActual.BDAQuantity) AS SumOfBDAQuantity
SELECT dbo_btBatchDailyActual.IONumber, dbo_btBatchDailyActual.MONumber, dbo_btBatchDailyActual.BatchNumber, Sum(dbo_btBatchDailyActual.BDAQuantity) AS [Total Of BDAQuantity]
FROM dbo_btBatchDailyActual
GROUP BY dbo_btBatchDailyActual.IONumber, dbo_btBatchDailyActual.MONumber, dbo_btBatchDailyActual.BatchNumber
PIVOT Format([BDADate],"Short Date");

I tried to execute this statement in Query Analyzer but it failed. I just thought that this code can't be easily executed in Query Analyzer and will need some revisions.
I was just thinking of the possible equivalent of the statement above in T-SQL.

-Dhodie

 
Old June 17th, 2004, 08:53 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is no "Transform" function in sql server. You can use the case predicate. You can read on it in books on line.



Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server Crosstab Query elygp SQL Server 2000 2 May 5th, 2007 11:57 AM
crosstab query and asp tulincim Classic ASP Databases 0 September 13th, 2005 03:00 PM
Crosstab Query Ben Access 7 November 22nd, 2004 06:08 AM
Crosstab query Berni016x SQL Server 2000 2 September 17th, 2004 10:43 AM
Crosstab query vladimir Access 1 December 1st, 2003 04:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.