You have worked hard to create the smartest stored procedure ever for your database. You can now store its results in a table. This article welcomes you to take advantage of PartitionDB Add-in that allows you to store the results of a procedure into a table.

Here are some use cases

  • Execute a stored procedure in different times, and compare the results to see how your database evolves.

  • Run stored procedures on different databases, so you can easily compare the results.

  • Have the stored procedure output the input for another stored procedure.

  • If your returns lots of data, storing it in a table enables data manipulation in a simple manner.

  • And there are many more ways to use this option, based on your business needs.

PartitionDB Add-in will store your valuable results in a table with one function call. In order to do so, pass your procedure name and table name and you are all set. Make sure to first download and restore PdbLogic to your database.

Example

In this example a database is created, TestExecuteIntoTables and a stored procedure, SPTest1. Then the function PdbexecuteInto is called. We pass it the database name, a procedure to execute and a table name to store the procedure’s output, in this case TableValuesFromSPTest2.

Once executing, a table will be created, and will store all the results of the stored procedure.

Use it every time you wish to store your procedure’s results. It is simple and straightforward.

For your reference, here is a list of optional configuration parameters for PdbexecuteInto:

Parameter Name Description Mandatory
TargetDatabaseName Name of target database No
ExecuteCommand Execution command for stored procedure Yes
TargetSchmaName Name of schema No
TargetObjectName Name of table to store results Yes
IsOutputScript Decide if print the command or run it No

To use this partitioning option and other PartitionDB utilities, download our PdbLogic and attach to your database. .
To learn more about PartitionDB capabilities check out our blog.