Writing directly in SQL tables

Gonzalo
Member Posts: 19
Hi experts,
We have an external application which creates records directly in sql nav tables (I know is highly not recommended).
If I do a run or a COUNT from NAV, I see less records than directly in the sql. (The property DataPerCompany is YES)
Is this normal?? Do you know how can I solve this issue??
(I know that we've to use web services instead of that and we're doing it, but it takes time...)
My client is in NAV 2016, I didn't have this problem with the previous versions. Does Microsoft changed something regarding this??? Any piece of advice??
Thanks
Gonzalo
We have an external application which creates records directly in sql nav tables (I know is highly not recommended).
If I do a run or a COUNT from NAV, I see less records than directly in the sql. (The property DataPerCompany is YES)
Is this normal?? Do you know how can I solve this issue??
(I know that we've to use web services instead of that and we're doing it, but it takes time...)
My client is in NAV 2016, I didn't have this problem with the previous versions. Does Microsoft changed something regarding this??? Any piece of advice??
Thanks
Gonzalo
0
Best Answers
-
This sounds like a caching problem. Right before your COUNT statement in NAV, try putting a SELECTLATESTVERSION, which tells NAV to ignore the cache in the service tier and re-fetch data directly from the SQL server.Kyle Hardin - ArcherPoint5
-
Hey Gonzalo,
Whenever you create a new company in NAV, SQL too creates a new company so I dont think DatePerCompany will have an effect on this.
Select * FROM [TestompanyOne$Sales Header] For one Company
Select * FROM [TestompanyTwo$Sales Header] For Second Company
Stop and Restart your service from Services.MSC + You can try using SELECTLATESTVERSION as if its a cache memory Issue .Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/5 -
The NAV Servicetier cache does not expect someone else writing to it's database. So it does not always go to the SQL DB for data but uses its cache. SELECTLATESTVERSION fixes this.
Another trick is to define a query object on that table and read from the query object. Query objects go always directly to SQL DB and do not use the cache in the service tier (but it is easier is to use SELECTLATESTVERSION...).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!5
Answers
-
This sounds like a caching problem. Right before your COUNT statement in NAV, try putting a SELECTLATESTVERSION, which tells NAV to ignore the cache in the service tier and re-fetch data directly from the SQL server.Kyle Hardin - ArcherPoint5
-
Hey Gonzalo,
Whenever you create a new company in NAV, SQL too creates a new company so I dont think DatePerCompany will have an effect on this.
Select * FROM [TestompanyOne$Sales Header] For one Company
Select * FROM [TestompanyTwo$Sales Header] For Second Company
Stop and Restart your service from Services.MSC + You can try using SELECTLATESTVERSION as if its a cache memory Issue .Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/5 -
The NAV Servicetier cache does not expect someone else writing to it's database. So it does not always go to the SQL DB for data but uses its cache. SELECTLATESTVERSION fixes this.
Another trick is to define a query object on that table and read from the query object. Query objects go always directly to SQL DB and do not use the cache in the service tier (but it is easier is to use SELECTLATESTVERSION...).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!5 -
Thanks, SELECTLASTVERSION worked properly!!!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