Sample DB Importer Queries

From Documentation | Viadat Creations
Revision as of 07:52, 3 February 2010 by Admin (talk | contribs) (For example, if your database table is named "store_locations":)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For example, if the original database table that you want to import locations from is named "store_locations", you can do the following:

SELECT * FROM store_locations

(It will pull all information from your 'store_locations' table into the Store Locator admin interface in order to be matched to the "wp_store_locator")

If you would like to import 200 locations at a time, so you don't overwhelm your database:

SELECT * FROM store_locations LIMIT 200


If for instance your "phone" field has numbers in the format ##########, but you want it to look like (###) ###-####:

UPDATE wp_store_locator SET sl_phone = CONCAT( "(", SUBSTRING( sl_phone, 1, 3 ) , ") ", SUBSTRING( sl_phone, 4, 3 ) , "-", SUBSTRING( sl_phone, 7, 4 ) )

(Note: If your WordPress prefix isn't "wp_", then update "wp_store_locator" in the below query to "{your WordPress prefix}store_locator")