Skip to main content
Dynamics GP (Enterprise) - Deleted Archived ASNs
Micah A. Parker avatar
Written by Micah A. Parker
Updated over 2 years ago

If you're having issues loading a large amount of data within your ASN Main window for the TrueCommerce SOP module - you may need to clear out old transactions from your Archived tabled.

Stored Procedure


The Stored Procedure (see below) can be ran against your company database in order to permanently delete old ASNs that have been Archived. Anything at or below the date given will be deleted.

Navigate: Company Database β†’ Programmability β†’ EDI_Delete_ASNs_CUSTNMBR_ACTLSHIP

Right Click: Execute Stored Procedure

ACTLDATE: Date format 2021-05-01 00:00:00.000

CUSTNMBR: Dynamics GP Customer Number

SQL Script


Note: Replace [TWO] with your Dynamics GP company database.

USE [TWO]
GO

/****** Object: StoredProcedure [dbo].[EDI_Delete_ASNs_CUSTNMBR_ACTLSHIP] Script Date: 5/5/2016 4:38:15 PM ******/

/***** date format is CCYY-MM-DD HH:MM:SS.SSS example: 2016-05-01 00:00:00.000 *****/
/***** CUSTNBMR is the GP Customer Number *****/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER OFF
GO



CREATE PROCEDURE [dbo].[EDI_Delete_ASNs_CUSTNMBR_ACTLSHIP]
@ACTDATE datetime,
@CUSTNMBR char(40)

AS

DELETE ESI30300 WHERE ESISHPID IN
(SELECT ESISHPID FROM ESI30000 WHERE ACTLSHIP < @ACTDATE and CUSTNMBR = @CUSTNMBR)

DELETE ESI30200 WHERE ESISHPID IN
(SELECT ESISHPID FROM ESI30000 WHERE ACTLSHIP < @ACTDATE and CUSTNMBR = @CUSTNMBR)

DELETE ESI30100 WHERE ESISHPID IN
(SELECT ESISHPID FROM ESI30000 WHERE ACTLSHIP < @ACTDATE and CUSTNMBR = @CUSTNMBR)

DELETE ESI30001 WHERE ESISHPID IN
(SELECT ESISHPID FROM ESI30000 WHERE ACTLSHIP < @ACTDATE and CUSTNMBR = @CUSTNMBR)

DELETE ESI30000 WHERE ACTLSHIP < @ACTDATE and CUSTNMBR = @CUSTNMBR

GO


Warning

SQL Scripts are provided as-is and are considered run-at-your-own-risk.

Always consult your System Administrator prior to running scripts

rev 12/23/22

Did this answer your question?