Solved

PIVOT works fine for MsAccess - Now I am converting to MSSql - How please?

Posted on 2011-02-20
5
280 Views
Last Modified: 2012-05-11

this PIVOT works fine for MsAccess - Now I am converting to MSSql - How would I do this  please?

TRANSFORM Sum(AceData.InCredit) AS SumOfInCredit
SELECT AceData.Type
FROM ListJob INNER JOIN AceData ON ListJob.JobList = AceData.Job
WHERE (((ListJob.ScenarioAccountant)=True))
GROUP BY AceData.Type
PIVOT AceData.Job;
0
Comment
Question by:goodk
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
borki earned 250 total points
ID: 34938789
Which version of SQL Server? Pivot is one of the areas that have been improved in the last few versions of MS SQL.

Here is one method that I have used with SQL 2000:
http://www.sqlteam.com/article/dynamic-cross-tabs-pivot-tables

In SQL 2005 and beyond you have the PIVOT statement, which is nowhere near as convenient as the TRANSFORM in Access. There are some good articles out there, start with:
http://www.kodyaz.com/articles/t-sql-pivot-tables-in-sql-server-tutorial-with-examples.aspx

Good luck
0
 

Author Comment

by:goodk
ID: 34962623
sql 2008

Microsoft SQL Server Management Studio                                    10.0.2531.0
Microsoft Data Access Components (MDAC)                                    6.0.6002.18005
Microsoft MSXML                                    3.0 4.0 5.0 6.0
Microsoft Internet Explorer                                    8.0.6001.19019
Microsoft .NET Framework                                    2.0.50727.4206
Operating System                                    6.0.6002
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 250 total points
ID: 34962692
Just so we are clear, can you post exactly what happens if you run the SQL you posted in SQL Server?
Also state the version of SQL Server you are using.

See here:
http://msdn.microsoft.com/en-us/library/ms177410.aspx

Or see this utility:
http://www.rac4sql.net/


JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34962701
<Also state the version of SQL Server you are using.>
...never mind, you already did that...

;-)
0
 

Author Closing Comment

by:goodk
ID: 34988524
partial
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question