07 June 2010

Weekly Dynamic: Run A/R Aging from SQL

Running A/R aging can take a while. In previous tips we’ve seen that cleaning up paid transactions via Paid Transaction Removal can help speed this up . Well, this week we look at how to run A/R aging from SQL, skipping the interface all together.
Running this script in SQL server will perform an A/R aging through the current date. Changing the @I_dAgingDate  variable changes the date the aging runs through.
SET NOCOUNT ON
DECLARE @O_iErrorState int, @I_dAgingDate datetime
  SELECT @I_dAgingDate = convert(varchar(10), GetDate(), 102)
EXEC dbo.rmAgeCustomer 0, '', 'þþþþþþþþþþþþþþþ', @I_dAgingDate, 127, 0, 0, '', @O_iErrorState OUT
--SELECT @O_iErrorState
SET NOCOUNT OFF

DynamicAccounting.net fan Mark Wiley was kind enough to supply this Weekly Dynamic and let me share it with the you.

Update: I missed that Michael Johnson posted this in April of 2009 so he get the credit too. Sorry about that Michael.