Access TRANSFORM statement in SQL

Posted on 2011-10-28
Last Modified: 2012-05-12
I have the following statement from Access that I would like to execute in SQL but I can't figure out how to convert it:

TRANSFORM Sum(dbo.table1.Hours) AS SumOfHours
Question by:zintech
    1 Comment
    LVL 92

    Accepted Solution

    There is no such item in Transact SQL.  It uses PIVOT instead, but PIVOT has its limitations.

    Microsoft MVP mark_wills demonstrates an excellent dynamic approach here:

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    754 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

    18 Experts available now in Live!

    Get 1:1 Help Now