Keep up to date with the latest information about Microsfot Dynamics GP through articles from the Perfect Image and azurecurve blog.
Insert Inventory User Categories From CSV
September 24th, 2015 by Ian Grieve
One client who was using Inventory was entering a lot of user categories, mistakenly entered the description into the Image field. In that case I did not know that they were populating the User Categories or I would have offered this script to them to save time.
To use the script you need a CSV file with four columns: User Category Value (the ID of the item you want to load), User Category Number (which of the user categories into which the row is to be loaded), Image URL and Description:
CREATE TABLE #UploadData (USCATVAL VARCHAR(100) ,USCATNUM VARCHAR(1) ,Image_URL VARCHAR(300) ,UserCatLongDescr VARCHAR(300)) GO BULK INSERT #UploadData FROM 'c:\temp\UserCategories.csv' WITH (FIELDTERMINATOR = ',' ,ROWTERMINATOR = '\n') GO INSERT INTO IV40600 (USCATVAL ,USCATNUM ,Image_URL ,UserCatLongDescr) (SELECT LEFT(UD.USCATVAL, 10) ,LEFT(UD.USCATNUM, 1) ,LEFT(UD.Image_URL, 254) ,LEFT(UD.UserCatLongDescr, 254) FROM #UploadData AS UD WHERE (SELECT COUNT(IV.USCATVAL) FROM IV40600 AS IV WHERE IV.USCATVAL = UD.USCATVAL AND IV.USCATNUM = UD.USCATNUM) = 0) GO DROP TABLE #UploadData GO
You will need to change the highlighted line to the location of your CSV file. As always before running a script on live, test it in a test company first and have a good backup of your database.