Building Crosstabs from Access to SQL Server

I had to do a Cross Tab today.

I had the code in MS/ACCESS as a
TRANSFORM statement and set about
creating a procedure to emulate it in
SQL/Server.

The main aim was to recreate the report that I had produced
in ACCESS
and it does.

It should also do everything else that you
would expect of the
TRANSFORM statement and more.
It is in a very
embryonic state at the moment and will probably
undergo several
facelifts.
There is no error checking so use the @debug option to see what is

going on behind the scenes.

I’d like to share the code for comments
and suggestions for
improvements.

As with all my code the comments
are sparse and badly spelt.

Most of my procedures and tables live in a
database called common. I
prefer to place code in this database rather than
master.
Partly because I can copy the common database from server to
server.

Anyway here goes

transform_table.SQL
transform_xample.SQL
transform3.SQL

Note the transform procedure requires the previously posted
batch_tsql
procedure

Have fun.

Download the batch utility

Latest Articles