Difference between revisions of "Sample DB Importer Queries"

From Documentation | Viadat Creations
Jump to: navigation, search
m (Protected "Sample DB Importer Queries": Excessive vandalism ([edit=autoconfirmed] (indefinite)))
(For example, if your database table is named "store_locations":)
 
Line 1: Line 1:
===For example, if your database table is named "store_locations":===
+
===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
 
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")
 
(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:===
 
===If you would like to import 200 locations at a time, so you don't overwhelm your database:===

Latest revision as of 13:52, 3 February 2010

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")