This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posting the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script was created a while ago when I was doing some testing on a client system and wanted to quickly insert some creditor item numbers; in fact, it inserts a creditor item number for every single creditor/item combination.
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
INSERT INTO dbo.IV00103
(ITEMNMBR
,VENDORID
,ITMVNDTY
,VNDITNUM
,QTYRQSTN
,QTYONORD
,QTY_Drop_Shipped
,LSTORDDT
,LSORDQTY
,LRCPTQTY
,LSRCPTDT
,LRCPTCST
,AVRGLDTM
,NORCTITM
,MINORQTY
,MAXORDQTY
,ECORDQTY
,VNDITDSC
,Last_Originating_Cost
,Last_Currency_ID
,FREEONBOARD
,PRCHSUOM
,CURRNIDX
,PLANNINGLEADTIME
,ORDERMULTIPLE
,MNFCTRITMNMBR)
--VALUES
(SELECT
IV101.ITEMNMBR
,PM2.VENDORID
,2
,IV101.ITEMNMBR
,0,0,0
,'1900-01-01 00:00:00.000'
,0,0
,'1900-01-01 00:00:00.000'
,0,0,0,0,0,0
,IV101.ITEMDESC
,0
,'' -- CURRENCY
,1,'',9,0,1,''
FROM
PM00200 AS PM2
CROSS JOIN
IV00101 AS IV101
LEFT JOIN
IV00103 AS IV103
ON
IV103.VENDORID = PM2.VENDORID
AND
IV103.ITEMNMBR = IV101.ITEMNMBR
WHERE
IV103.VENDORID IS NULL)
If you use this script, make sure you test thoroughly before running on a production system. After running the script, you may need to run an Inventory Reconcile.