replacing multiple table information in mysql - mysql

I've recently been given the task of maintaining a sports team's website and have encountered a problem which I cannot find the answer.
It uses Nucleus CMS which is fine and I'm used to it, unfortunately, the domain name has changed and all links and files within the site stored in the mysql database are now out of date and not the correct one.
I am able to manually alter each item using the admin panel of the CMS, but with several thousand posts, that task is daunting.
Is there a way I can do a "replace" domain1.com to domain2.com in the item table in one process through the mysql database?
Forgive me if I'm not using the correct terminology.

Try this:
UPDATE tbl SET domain_name = 'domain2.com' WHERE domain_name = 'domain1.com';

Related

Questions about Sharepoint Lists created by the Access data migration wizard (location, deletion, updates)

I have years of Access programming under my belt, with either Access or SQL back ends. I'm volunteering my time to help a small nonprofit build a volunteer database. We are forced to use SharePoint Lists as the data backend.
Our first migration using the Access wizard worked but messed up the data because I had not created all the required relationships prior to upsizing. I did my homework, and we tried again. But even though we created a folder for all those files, the Access wizard put the lists at the root of the SharePoint file, and now they are mixed with the first round of tables, as well as other folk's stuff. So, my questions are:
Can we specify where those SharePoint Lists are stored beyond the root directory? (I worry that others may inadvertently edit those lists...)
How do I delete the lists? It says we cannot because relationships are set
How do I in the future alter the lists (like altering tables in SQL?) I know I'll need to add columns eventually.
I've searched MS and here, and MS solutions are crazy simplified, so they don't answer my questions. TIA!
Can we specify where those SharePoint Lists are stored beyond the root directory? (I worry that others may inadvertently edit those lists...)
Yes, go to the SharePoint site. From ONLY the Team site, create a sub site.
(regular sites don't work - MUST BE A CHILD of TeamSite).
You can up-size the access tables to that site.
So, just like creating a folder, or in this case a site?
Say you create a new teamsite (MUST be subsite - so crete a subsite to teamsite) called Customers. Then you can specify that target for the database. As noted, since the access table features are "special", only sites created as sub sites to TeamSite(s) will work.
So, it stands to reason that each database should get its own site (perhaps better term is sub-site). Then you can up-load/up-size a database to that one team site you just created - and all tables are thus "grouped" or part of that "one" site or URL.
So say we have a database called customers - then we create a (sub) site called customers. Your url would thus be "something" like this:
https://myCompanyName.sharepoint.com/TeamSite/Customers
How do I delete the lists? It says we cannot because relationships
Well, actually, even in Access regular tables - you as a general rule can't delete a table that is part of a related set of tables. This suggests then you have to delete the relationships first.
Display the site contents,
right click on the child table that has the related column
(choose settings).
You now are in the "settings" for that one table/list.
You can click on the column that has the relationship.
You see this:
So, you can remove the relationship. (scroll down to bottom).
And if those tables are LINKED from access?
You can use the table view in Access - and change/add columns - you do NOT necessary have to do this from the web interface.
How do I in the future alter the lists (like altering tables in SQL?) I know I'll need to add columns eventually.
You can do this from Access or SharePoint - Access side is better choice.
if the table is linked from Access, then use the table view. You not be able to jump into table design mode - but if you open a table, you see this:
And while in above I am on the last (add new) column, if I wanted to say change or add a index to say FirstName column? I could do this on SharePoint, but you ALSO can just click on any column - note the ribbon now:
So, all this is quite much basic SharePoint stuff.
But, open the linked list - you can add new columns, or remove columns - the above ribbon options show the options you have (such as index, etc.). And like always, to delete a column, in that table view from Access, right click - you have this option:
So, you add, or delete fields BOTH from the SharePoint site, or from the above table view in Access.

Find Character In Primary Key and Update a field

I'm working on a e-commerce website that uses CMS that uses MS Access 2000 database. The CMS generates the website pages on upload so there's no database online other than Perl files to control the shopping cart. The CMS allows the creation of duplicate products that can be placed elsewhere on the site
I have a table called PRODUCTS in my database. Whereby if a product is a duplicate of the original it contains ! in the primary key
Within the Product table I wish to turn off a setting for all the duplicate products only in the database.
I'm trying to create an SQL statement which would say..
FROM Products
Where Product_Reference contains the character !
Set Can_Be_Ordered_Online to False
Can anyone help?
In regular MySQL it will be something like this:
UPDATE Products
SET Products.Can_Be_Ordered_Online = 0
WHERE Products.Product_Reference LIKE '*!*';
It's hard to find MS Access 2000 docs online these days :(
Luckily, I've found this document about LIKE condition, therefore I've just updated my answer. % character is MySQL and other SQL-s wildcard, apparently in MS Access 2003 (and with some luck in MSA 2000 too!) the wildcard char are *, # and ?.
Nice history lesson :)
What you're looking for is something like that:
UPDATE PRODUCTS SET Can_Be_Ordered_Online = FALSE
WHERE Product_Reference LIKE '%!%'
If the ! is always at the end or at the start, you can remove one of the %.

Organizing a database using folders in phpMyAdmin

Right now I have a database in phpMyAdmin, and off the the side of the screen, it shows the database name, and a list of tables inside the database. It's fine if it's only a couple of tables, but when there's dozens of tables, it gets hard to find the tables I want to edit. I've thought about creating another database to make it easier to organize, but then I'll have to connect using the different database's name and a different user login for the database, and I just thought how much easier would it be if I can make folders or something similar inside the database I already have to organize my tables. I'm wondering if something like this is possible, or anyone know any work-around this issue.
Well, you can't create a database (or folders) within a database; that's just not something MySQL is able to do.
phpMyAdmin has a grouping feature that may help your situation. By default, databases with a prefix followed by _ (a single underscore) will be grouped together, as will tables with __ (two underscores).
Here's an example of how this ends up looking when grouped:
Database:
Table:
If you're able to rename some of your tables, you'll be able to take advantage of the grouping feature to make the phpMyAdmin display a bit more manageable. Of course, this won't change the way other tools display the table list.
The configuration directives $cfg['NavigationTreeDbSeparator'] and $cfg['NavigationTreeTableSeparator'] control the separator used. The relevant documentation starts at http://docs.phpmyadmin.net/en/latest/config.html#cfg_NavigationTreeEnableGrouping and includes the next few line items.

Matching two columns from a database

I'm gonna implement a new design / website structure for a customer, but I have a little problem. Since the URLs I've created are a bit different, I'm anticipating a problem with the SEO rankings due to the bunch of broken URLs. My idea is to match the existing URLs (from the old site) with the new ones I've created.
The problem I've stumbled upon is the following:
The old URLs are like http://www.example.com/category/numeric_id-item-name_item_code.html and the new URLs are likehttp://www.example.com/item_name-item_code.
In MySQL I created a new database containing on the first column the item_name and item_code from the old website and a second column the same info from the new database.
The idea is as it follows:
Example: Let's say we have an item named spring leaf with the code sl34. The old URL would be something like http://www.example.com/springs/53-spring-leaf-sl34.html.
For matching this URL there are 3 possibilities:
If the product is in the new website http://www.example.com/spring-leaf-sl34
In case they modified the name http://www.example.com/iron-spring-leaf-sl34
In case the product is not in the new website: http://www.example.com/springs
I need help on creating these matches.
Thank you.
So, apparently, I've found some kind of quick fix:
CREATE
VIEW `database`.`url_view`
AS
(SELECT old_table.old_url, new_table.new_url FROM old_table LEFT JOIN new_table ON old_table.product_code=new_table.product_code);
This will associate the old URLs with the new ones, and, if an old URL (product) is no longer available it will insert a (NULL) entry.

Where is user profile information stored in the Dotnetnuke database?

Here is the situation I'm in:
I just implemented a DNN site. I already have a huge database table of users. Now when my users come in to register for my DNN site, they're required to put in a first name, last name and DOB. I will then use this information to match their records to the existing user table via a SQL query. The only problem is I can't find "DOB" field anywhere, in any table or for that matter most of the rest of the profile information. Is it even stored in the database? or am I just blind?
The best answer I could find was from a dnn forum which stated
"User profile information is stored in several tables in the database. The 'Users' table is the place to start for basic information. There are several tables that have "profile" in the name that also are important."
I've looked through almost every table in the database, but with no luck...
I'm using DNN 6.0 with SQL Server 2008
I've looked everywhere but can't find it. Any help or guidance from anyone would be much appreciated! Even a paid solution like a pre-built module would work.
Thanks
Look in the ProfilePropertyDefinition table for the PropertyDefinitionId of the dateOfBirth property. Then, with that id, and the id of the user, you can query the UserProfile table to retrieve the value.
There is more at this blog post
http://erikvanballegoij.com/Home/itemid/28/Selecting-profile-properties-the-easy-way