Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2004, 09:12 PM
Authorized User
 
Join Date: Jun 2003
Location: Makati City, , Philippines.
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

Reply With Quote
  #2 (permalink)  
Old June 10th, 2004, 09:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
  #3 (permalink)  
Old June 10th, 2004, 09:52 PM
Authorized User
 
Join Date: Jun 2003
Location: Makati City, , Philippines.
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

Reply With Quote
  #4 (permalink)  
Old June 17th, 2004, 08:53 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.