

Get in touch

Download Plugin Now
  • Follow
  • Follow
WP Data Access
  • Download
  • Support
  • Features
  • Pricing
  • Documentation
    • Tool Guide
    • App Builder
    • Data Explorer
    • SQL Query Builder
    • Plugin Settings
    • Legacy Tools
    • Remote Connections
a
M
M
  • Download
  • Support
  • Features
  • Pricing
  • Documentation
    • Tool Guide
    • App Builder
    • Data Explorer
    • SQL Query Builder
    • Plugin Settings
    • Legacy Tools
    • Remote Connections
Download Plugin Now

SQL Query Builder

  • Getting Started
  • Tutorials
  • Visual Query Builder
  • Writing queries
  • Data exchange
  • Stored procedures
  • Database triggers
  • Scheduled queries
  • WordPress user ID in SQL
View Categories

Data exchange

A tab in the Query Builder is related to a specific database. Although the Query Builder supports the USE database command to switch to another database, it is not possible to have two connection at the same time. This makes it impossible to copy table data from one database to another.

To allow plugin users to exchange data between different databases two plugin commands were added. Please note these are NOT MySQL commands. They only work within the Query Builder.

WPDAVAR (or wpdavar) #

WPDAVAR saves the last query result in a variable. The following code selects all records from table genre and stores the result in WP Data Access variable my_genres:

select * from genre
/

wpdavar my_genres
/

WPDATMP (or wpdatmp) #

WPDATMP creates a temporary table from the data available in a variable that was previously saved with WPDAVAR. The following code extends the previous code by creating a temporary table from the query result available in variable my_genres. The temporary table get the same name as the temporary variable.

select * from genre
/

wpdavar my_genres
/

use rdb:my_remote_database
/

wpdatmp my_genres
/

Exchanging data between different databases #

The following example shows how table genre is copied from my remote database to my wordpress database.

use rdb:my_remote_database
/

select * from genre
/

wpdavar my_genres
/

use wordpress
/

wpdatmp my_genres
/

insert into genre select * from my_genres
/

Limitations #

The previous example copies table genre entirely into variable my_genre. This might require a lot of memory and will not work with large tables. For large tables the procedure needs to be divided in a number of smaller chunks.

Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on 2025-02-07

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • WPDAVAR (or wpdavar)
  • WPDATMP (or wpdatmp)
  • Exchanging data between different databases
  • Limitations
WP Data Access
  • Follow
  • Follow
Quick Links
$

Blogs

$

Tutorials

$

Demos

Get in touch
$

Premium support

$

Free support forum

$

Contact us

Resources


WordPress plugin directory



YouTube tutorials

Copyright © 2025 | All Right Reserves

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok