markscarts Posted February 8, 2006 Share Posted February 8, 2006 I want to empty my inventory table and cats_idx on one of my sites. The categories will remain the same. I assume the best way to empty the inventory table is: TRUNCATE TABLE CubeCart_inventory; If I use this command, will it empty the auto_increment counts as well as emptying the records from the table? IOW, after truncating this table, when I re-populate it, will the record id begin at 1? Thanks fo any information. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2006 Share Posted February 8, 2006 Yup Mark. That'll do what you want. You'll also want to TRUNCATE TABLE CubeCart_cats_idx; as well :blink: Quote Link to comment Share on other sites More sharing options...
Guest EverythingWeb Posted February 8, 2006 Share Posted February 8, 2006 Hi Mark, The auto-increment value is stored as one of the properties of the tables. For example, here is a dump of one of our test stores' inventory tables: CREATE TABLE `306test_CubeCart_inventory` ( `productId` int(11) NOT NULL auto_increment, `productCode` varchar(60) NOT NULL default '', `quantity` int(16) NOT NULL default '1', `description` text NOT NULL, `image` varchar(250) NOT NULL default '', `noImages` int(11) NOT NULL default '0', `price` decimal(30,2) NOT NULL default '0.00', `name` varchar(250) NOT NULL default '0', `cat_id` int(16) NOT NULL default '0', `popularity` bigint(64) NOT NULL default '0', `sale_price` decimal(30,2) NOT NULL default '0.00', `stock_level` int(11) default '0', `useStockLevel` int(11) default '1', `digital` int(11) NOT NULL default '0', `digitalDir` varchar(255) default NULL, `prodWeight` decimal(10,3) default NULL, `taxType` int(11) default NULL, `showFeatured` int(11) NOT NULL default '1', PRIMARY KEY (`productId`) ) TYPE=MyISAM AUTO_INCREMENT=3; What I would suggest, AFTER BACKING UP, is to export the structure of the table, edit the bottom line to read: 'AUTO_INCREMENT=1' and re-create the table, thus putting your auto increment back to 1. Hope this helps. Quote Link to comment Share on other sites More sharing options...
markscarts Posted February 8, 2006 Author Share Posted February 8, 2006 Thanks guys - what I've done so far: truncated both cats_idx and inventory - then uploaded 1775 products into inventory under their main categories, and updated cats_idx . . . Then I uploaded the first round of cross-reference info to cats_idx to add those 1775 products to other categories. In a few moments, I will do the next round of cross-references to add select numbers to other cats as well, then when all is done I'll run fixCatCount utility. So far, all seems to be successfull The first cat, shot glasses, will be last to populate . . . http://avftexas.com/bellissimo/index.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.