Posts

Showing posts from January, 2017

SQL query for AX 2012 to find number sequence Id's which are near to run out

select top 10 (1.00 * HIGHEST - 1.00 * NEXTREC) / (1.00 * HIGHEST - 1.00 * LOWEST), * from numbersequencetable with (nolock) where (1.00 * HIGHEST - 1.00 * NEXTREC) / (1.00 * HIGHEST - 1.00 * LOWEST) < 0.2 SELECT TOP 10 * FROM dbo.LEDGERJOURNALTABLE WITH (NOLOCK) WHERE JOURNALNUM LIKE 'num seq' ORDER BY RECID DESC