Sql scripts for ledger tables checking

rmv_RU
Member Posts: 119
Hi all, let me share some useful sql scripts, it really helps me in my daily routine.
1. GL Consistency check.
The script shows a list of posted documents, which are not balanced
1. Copy text into a Query Analizer or a SQL Server Management Studio.
2. Replace $Company with an actual company name.
3. Run the script.
1. GL Consistency check.
The script shows a list of posted documents, which are not balanced
select [Document No_], [Posting Date], sum(Amount) as Amount, sum([Additional-Currency Amount]) as [Additional-Currency Amount] from [Company$G_L Entry] group by [Document No_], [Posting Date] having sum(Amount) <>0 or sum([Additional-Currency Amount])<>0How to run:
1. Copy text into a Query Analizer or a SQL Server Management Studio.
2. Replace $Company with an actual company name.
3. Run the script.
Looking for part-time work.
Nav, T-SQL.
Nav, T-SQL.
0
Comments
-
2. Item Ledger Entry Consistency check.
Sum(quantity) must be equal to Sum([Remaining Quantity] by Item No..
The script shows problem Items.select [Item No_], sum(Quantity) as Qty, sum([Remaining Quantity]) as RemQty from [Company$item ledger entry] ile group by [Item No_] having sum(Quantity) <> sum([Remaining Quantity])
How to run:
1. Copy text into a Query Analizer or a SQL Server Management Studio.
2. Replace $Company with an actual company name.
3. Run the script.Looking for part-time work.
Nav, T-SQL.0 -
3. Item Ledger Entry and Item Application Entry Consistency check.
"Item Ledger Entry"."Remaining Quantity" of positive(inbound) entry must be equal to a sum("Item Application Entry".Quantity) by the entry.
The script shows problem item ledger entries.select * from ( select ILE.[Entry No_], ILE.[Document No_], ILE.[Posting Date], ILE.[Item No_], cast(ILE.[Quantity] as money) as quantity, cast(ILE.[Remaining Quantity] as money) as [Remaining Quantity], (select cast(sum(Quantity) as money) from [Company$Item Application Entry] IAE where IAE.[Inbound Item Entry No_]=ILE.[Entry No_]) as AppQty from [Company$Item Ledger Entry] ILE where ILE.Positive=1 ) t where [Remaining Quantity]<>AppQty order by [Posting Date]
How to run:
1. Copy text into a Query Analizer or a SQL Server Management Studio.
2. Replace $Company with an actual company name.
3. Run the script.Looking for part-time work.
Nav, T-SQL.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions