Solved

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

Posted on 2011-02-20
5
277 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

705 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now