ODBC: Custom Queries

The ODBC Custom Query is an available configuration option when setting up an ODBC store in the Stamps.com PC software. This feature allows you to specify the desired SQL queries that Stamps.com utilizes to download/upload information from/to your ODBC order source instead of mapping fields to a single database table. This is useful when your data resides in multiple tables or when you need to specify WHERE, GROUP BY, or other clauses.

This article will define the available query types that we support and guide you through enabling custom queries for your ODBC data source in the Stamps.com PC software.

Advanced Feature

This feature is for advanced users only. The software does not validate the custom queries used. Incorrectly specified SQL queries may not work and may adversely affect or corrupt your data.

This feature is provided "as is." Stamps.com makes no promises, warranties, or representations of any kind, and Stamps.com specifically disclaims all warranties and conditions, express, implied, statutory or otherwise, with respect to the subject matter hereof, including but not limited to implied warranties of merchantability or fitness for a particular purpose. In no event shall Stamps.com be liable to you for injury or any special, incidental, indirect or consequential damages of any kind, or any damages whatsoever resulting from loss of use, data or profits, business interruption or any other commercial damages or loss, whether or not advised of the possibility of damage, and on any theory of liability, arising out of or in connection with the custom queries feature.


Supported Query Types

The following query types are supported:

  • BatchOrder.sql: Required when importing orders from your data source into Orders in the Stamps.com software.

  • CountOrders.sql: Used to determine how many orders will be loaded into the Stamps.com software. This query is optional but recommended when importing into Orders in Stamps.com. Performance may be affected when this query is not specified.

  • SingleOrder.sql: Required when importing single orders using the Shipper Toolbar. Importing from the Shipper Toolbar will fail when this query type is not defined.

  • PostBack.sql: Required when posting the order status and tracking information back to your ODBC data source when shipping from either Orders or the Shipping Toolbar. This query does not need to be specified if you are not posting information back to your data source.

Enable Your Custom Queries

  1. Open the Profile Manager:

    • From Orders: Click the Manage Data Sources button and select Edit Source.

    • From the Shipper Toolbar: Click the Profile drop-down menu and select Manage Profiles.

  2. Select your ODBC profile and click the Edit button.

  3. Check the Custom Queries checkbox. Then, click the Browse button.


    A Windows folder will open. This folder is where you will place your custom query files.


    Files in the Windows Folder

    To assist you with writing your custom queries, we have included sample queries and a readme file in the Windows folder.

    • Readme.txt: Useful information on how to write custom queries, including the available import and postback variables and column names.

    • Sample .sql files: There is a sample .sql file for each query type you can use as a reference.

  4. Paste your custom query files into the folder. Be sure that each file is named with the correct name:

    • BatchOrder.sql

    • CountOrders.sql

    • SingleOrder.sql

    • PostBack.sql

  5. Return to the Stamps.com software. Click Done on the Edit Profile screen. Then, click Done to close the Manage Profiles window.

Your ODBC profile will now use your custom queries.

Was this article helpful?
0 out of 0 found this helpful

Can't find what you're looking for?

We’re here to help you.
Contact Our Team