Global vs. Local Tables mixup in Objects and SQL

geschwint
Member Posts: 10
Did a search on the Internet and has not seen anyone else having a similar issue. Read on:
SQL Server 2005
Nav 2009 SP1 Build 29626, Classic client only
Problem indication:
It is not possible to rename a Company. A message is displayed after some time requesting you to open a Company to work with this table. Error message is: "". There is nothing in Navision indicating issues with the table in question, code or properties. It is a local table and works fine per-Company with data in it. The debugger will not trigger on this since the problem is in the client, not in code.
Analysis and resolution:
After looking into the Objects table in SQL, it turns out this table, let's call it table1, exists both as a local table and global. In SQL I can find the physical table with all companynames, but I can also find it without companyname, thus a global table. After making this Discovery, I checked the objects table a little more in detail and found 32 tables with this flaw, existing as local and global at the same time. All tables with this flaw has an id >=50000, referring to both customer tables and add-on tables.
So Navision could not handle the fact that a table was defined in Navision as local but existed also as global. Using the table was OK but to rename a Company, the strange message surfaced.
The following can be run in the database to see what objects exists both as local and global:
The resolution was to remove the physical tables in SQL that was global in error, then remove the 32 lines in Objects table that should not be global.
To remove the lines from Objects table, run the following (same select as above but with delete instead):
Do not forget to make a backup before this destructive operation!!
After the above adjustment, a Company could be renamed without problems and the database is fresh again.
Has anyone seen anything even close to this total mixup of local vs. global tables?
SQL Server 2005
Nav 2009 SP1 Build 29626, Classic client only
Problem indication:
It is not possible to rename a Company. A message is displayed after some time requesting you to open a Company to work with this table. Error message is: "". There is nothing in Navision indicating issues with the table in question, code or properties. It is a local table and works fine per-Company with data in it. The debugger will not trigger on this since the problem is in the client, not in code.
Analysis and resolution:
After looking into the Objects table in SQL, it turns out this table, let's call it table1, exists both as a local table and global. In SQL I can find the physical table with all companynames, but I can also find it without companyname, thus a global table. After making this Discovery, I checked the objects table a little more in detail and found 32 tables with this flaw, existing as local and global at the same time. All tables with this flaw has an id >=50000, referring to both customer tables and add-on tables.
So Navision could not handle the fact that a table was defined in Navision as local but existed also as global. Using the table was OK but to rename a Company, the strange message surfaced.
The following can be run in the database to see what objects exists both as local and global:
SELECT * FROM [dbo].[Object] o1 WHERE [Company Name] = '' AND [Type] = 0 AND [BLOB Reference] IS NULL AND EXISTS ( SELECT 'X' FROM [dbo].[Object] o2 WHERE o2.[Company Name] <> '' AND o2.[Type] = 0 AND o2.[BLOB Reference] IS NULL AND o2.ID = o1.ID )The resulting list is the objects that must be removed to make the database Clean, all listed objects were checked in Navision and defined as local per company.
The resolution was to remove the physical tables in SQL that was global in error, then remove the 32 lines in Objects table that should not be global.
To remove the lines from Objects table, run the following (same select as above but with delete instead):
Do not forget to make a backup before this destructive operation!!
DELETE [dbo].[Object] FROM [dbo].[Object] o1 WHERE [Company Name] = '' AND [Type] = 0 AND [BLOB Reference] IS NULL AND EXISTS ( SELECT 'X' FROM [dbo].[Object] o2 WHERE o2.[Company Name] <> '' AND o2.[Type] = 0 AND o2.[BLOB Reference] IS NULL AND o2.ID = o1.ID )
After the above adjustment, a Company could be renamed without problems and the database is fresh again.
Has anyone seen anything even close to this total mixup of local vs. global tables?
Beautiful things can be performed using XSLT/XPATH/XML, Yes, I'm a geek
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