Updating Item Purchasing Unit Of Measure From A CSV

Microsoft Dynamics GPAfter 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;

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

1 thought on “Updating Item Purchasing Unit Of Measure From A CSV

Leave a Reply

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