Importing an existing Customers table
First, import your customer table as is into the Cartweaver database. Name it "Customers". Don't worry about matching fields at this point. Make sure you have a customer ID field, and if not create one before proceding.
Next, write an INSERT statement to match fields from Customers to tbl_Customers, for example the following (make sure you map all required fields):
INSERT tbl_customers (cst_ID, cst_LastName, cst_Address1, cst_City, cst_Zip, cst_ShpName, cst_ShpAddress, cst_ShpCity, cst_ShpZip, cst_Phone, cst_Username, cst_Password)
SELECT CustomerID as cst_ID, ContactName as cst_LastName,
Address as cst_Address1,
City as cst_City,
PostalCode as cst_Zip,
ContactName as cst_ShpName,
Address as cst_ShpAddress1,
City as cst_ShpCity,
PostalCode as cst_ShpZip,
Phone as cst_Phone,
Username as cst_Username,
Password as cst_Password
FROM Customers
Next, insert rows into the tbl_custstate table for shipping and billing states, using the cst_ID field to match up to the customerid field of the original table. For the following to work, your state abbreviation must match up with tbl_stateprov fields:
INSERT tbl_custstate (CustSt_Cust_ID, CustSt_StPrv_ID, CustSt_Destination)
SELECT c.CustomerID as CustSt_Cust_ID, s.stprv_ID as CustSt_StPrv_ID, 'ShipTo' as CustSt_Destination
FROM Customers c
INNER JOIN tbl_stateprov s
ON c.State = s.stprv_Code
Do the same for billing:
INSERT tbl_custstate (CustSt_Cust_ID, CustSt_StPrv_ID, CustSt_Destination)
SELECT c.CustomerID as CustSt_Cust_ID, s.stprv_ID as CustSt_StPrv_ID, 'BillTo' as CustSt_Destination
FROM Customers c
INNER JOIN tbl_stateprov s
ON c.State = s.stprv_Code
Do this on a test database first so that you can test out the results.