More in this section

Forums / Developing with Sitefinity / How to map categories to News items using database

How to map categories to News items using database

3 posts, 0 answered
  1. Venkat
    Venkat avatar
    105 posts
    20 Nov 2008
    12 Aug 2009
    Link to this post
    We categorized the news items into three categories and there are so many news items.

    we have back up of this data base , but it is a old database.

    some of our tester by mistake deleted the three categories and recreated those.

    The result is all  news items get lost its category values.I want to add category to all  news items.

    can any one please tell me the sql query to add category to the news items. by refering the old database.

    Note:Category ID s only changed but not the News item ids. so that I can take the old db as my reference and can change all news items which has the old category id to new category id.

    and where the news item data is storing. all category info and every thing.
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    12 Aug 2009
    Link to this post
    the way I would approach this is to set up a second site, a copy, using the old db as the source. on this copy, create a second news provider that points to the newer site's database. then create a page in the copy site (the one using the old db) that uses two NewsManagers, one for the old db and one for the new one.

    Then, using the News API, parse through each old one, retrieving it from the new one by the GUID, and set the category name that way.

    Of course, be sure to back up both dbs before doing this, just in case! but I believe this should work, let me know if I can be of any more help!
  3. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    14 Aug 2009
    Link to this post

    This seems like a workable solution indeed. Venkat, please try to use the API for this, this is the only way you could be sure that you will not have broken relations in the database.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Register for webinar
3 posts, 0 answered