VbzCart/procs/Upd Depts fr Depts Suppliers

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< VbzCart‎ | procs
Jump to: navigation, search


  • Purpose: fills _depts (does not set inPrint/inStock fields)
  • Input: cat_depts, cat_supp
  • Output: _depts (delete/insert)
  • History:
    • 2010-11-10 Fixed syntax so it works; created in database. (None of the procs were actually in the database since it was moved to Rizzo.)


<mysql>DELIMITER // DROP PROCEDURE IF EXISTS `Upd_Depts_fr_Depts_Suppliers`// CREATE PROCEDURE Upd_Depts_fr_Depts_Suppliers() BEGIN

   DELETE FROM _depts;
   INSERT INTO _depts(`ID`,`ID_Supp`,`CatKey`,`CatNum`,`CatWeb_Dept`,`CatWeb_Title`)
       d.ID_Supplier AS ID_Supp,
       UPPER(IFNULL(d.PageKey,d.CatKey)) AS CatKey,
       UPPER(CONCAT_WS("-",s.CatKey,d.CatKey)) AS CatNum,
       LOWER(CONCAT_WS("/",s.CatKey,IFNULL(d.PageKey,d.CatKey))) AS CatWeb_Dept,
       LOWER(CONCAT_WS("/",s.CatKey,d.CatKey)) AS CatWeb_Title
     FROM cat_depts AS d LEFT JOIN cat_supp AS s ON d.ID_Supplier=s.ID;

END// DELIMITER ;</mysql>