Updating Item Purchasing Unit Of Measure From A CSV

After a slight mid-week diversion, here is another script I produced a while ago which updates the Item’s Default Purchasing Unit of Measure. It was produced when a client wanted to bulk update a large number of records which would have taken a long time manually but by script only minutes to write and run.

In Microsoft Dynamics GP, the Default Purchasing Unit of Measure is maintained in the Item Purchasing Options window (Cards >> Inventory >> Item Purchasing Options) along with the Purchasing Options (IV00106) but the Default Purchasing Unit of Measure is stored on the Item Master (IV00101) table;


CREATE TABLE #UploadData
   (ITEMNMBR VARCHAR(100)
   ,PRCHSUOM VARCHAR(100))
GO

BULK INSERT
   #UploadData
FROM
   'c:\temp\PRCHSUOM.csv'
WITH
   (FIELDTERMINATOR = ','
   ,ROWTERMINATOR = '\n')
GO

UPDATE
   ['Item Master']
SET
   PRCHSUOM = ['Upload Data'].PRCHSUOM
FROM
   IV00101 AS ['Item Master']
INNER JOIN
   #UploadData AS ['Upload Data']
      ON ['Upload Data'].ITEMNMBR = ['Item Master'].ITEMNMBR

DROP TABLE #UploadData

As always before running a script make sure you have a backup of your company database and only run the script if you’re comfortable working in SQL Server Management Studio.nbsp;

Ian Grieve

About Ian Grieve

Ian is a Microsoft Dynamics GP certified consultant specialising in the delivery of Microsoft Dynamics GP projects and currently working for Perfect Image Ltd., a Microsoft Partner and VAR in the North East of England. Ian has worked with Microsoft Dynamics GP since 2003 and, over the nine years since, has dealt with all aspects of the product life-cycle from presales, to implementation, to technical and functional training, to post go-live support and subsequent upgrades and process reviews. In his spare time, Ian runs the azurecurve | Ramblings of a Dynamics GP Consultant blog dedicated to Microsoft Dynamics GP and related products.
This entry was posted in Dynamics, GP, Microsoft and tagged , , , , , . Bookmark the permalink.

One comment on “Updating Item Purchasing Unit Of Measure From A CSV

  1. Pingback: Interesting Findings & Knowledge Sharing » Updating Item Purchasing Unit Of Measure From A CSV

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>