SQL – Turning Several Result Sets into a Single Result Set

In case you need to get several result sets through a single result set, for whatever reason. In my case I have program that works on one result set at a time that needed some aggregate data displayed at the end of the report. Here is what you do:

Create a temporary table to store the table with the most fields in your result set. Everything will use this table for its data. Be sure create a primary key using an int identity(1,1). Without creating a primary key the data will not be stored in any order.

Order the data the way you need it to display and insert it into the temporary table. Then add following result sets to this table.

Note: Data types are important in getting this to work and character/string based data types tend to work the best.

Computers Blogs
Computers

Advertisements

One thought on “SQL – Turning Several Result Sets into a Single Result Set

Have an opinion? Leave an opinion!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s