Nav Database with linked table (SQL view) Restore errors

rlawson
Member Posts: 48
Nav 5.0
I get the error "TableData 50004 does not exist" when restoring a backup with a SQL database (when I have 2 linked tables).
I read the MS Making Backups in the SQL Server Option page 19:
You must create a dummy view that selects literal values for its columns before restoring the backup. These literal values must be defined in terms of the appropriate SQL data type.
What does a dummy view mean?
How do I select literal values for its columns?
What is the syntax in SQL view?
I get the error "TableData 50004 does not exist" when restoring a backup with a SQL database (when I have 2 linked tables).
I read the MS Making Backups in the SQL Server Option page 19:
You must create a dummy view that selects literal values for its columns before restoring the backup. These literal values must be defined in terms of the appropriate SQL data type.
What does a dummy view mean?
How do I select literal values for its columns?
What is the syntax in SQL view?
0
Comments
-
Just grab the existing view on the sql server and replace the select statement with literal values like this:
USE [yourDBnamehere] GO /****** Object: View [dbo].[CompanyName$TableName] Script Date: 07/22/2008 19:26:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[CompanyName$TableName] AS select 0 as TransactionNumber, '' as ExtOrderNumber, 0 as BatchNumber, '' as ShippingNote1, '' as ShippingNote2, '' as ShippingNote3, '' as GiftMessage1, '' as GiftMessage2, '' as GiftMessage3
Just remember the data types have to map to your existing NAV fields.0 -
After changing the View with the following code:
Query for Navision Table 50003, RMS Transaction:
SELECT 0 AS TransactionNumber, ' ' AS ExtOrderNumber
Query for Navision Table 50004, RMS Notes:
SELECT 0 AS TransactionNumber, ' ' AS ExtOrderNumber, 0 AS BatchNumber, ' ' AS ShippingNote1, ' ' AS ShippingNote2, ' ' AS ShippingNote3,
' ' AS GiftMessage1, ' ' AS GiftMessage2, ' ' AS GiftMessage3
With these views in place for for my database, I are back to the message “Restoration of the backup was interrupted because the company ‘Crushpad TEST’ is already in the database.”
Any ideas?0 -
Script your new views and save them. Delete the database, recreate it and restore the backup.0
-
I have multiple companies and am trying to restore just a data backup of one company. What do I do here?0
-
That all sounds very complex. The way I do it is this:
1/ Create the NAV SQL Database.
2/ Restore the Linked database.
3/ Run the scripts to build the views in the NAV database.
4/ Restore the FBK file.
Done.David Singleton0 -
David Singleton wrote:That all sounds very complex. The way I do it is this:
1/ Create the NAV SQL Database.
2/ Restore the Linked database.
3/ Run the scripts to build the views in the NAV database.
4/ Restore the FBK file.
Done.0 -
DenSter wrote:David Singleton wrote:That all sounds very complex. The way I do it is this:
1/ Create the NAV SQL Database.
2/ Restore the Linked database.
3/ Run the scripts to build the views in the NAV database.
4/ Restore the FBK file.
Done.
The problem is when the views refer to tables that won't exist until the FBK is restored. You can't create the real views until those tables exist.There are no bugs - only undocumented features.0 -
bbrown wrote:DenSter wrote:David Singleton wrote:That all sounds very complex. The way I do it is this:
1/ Create the NAV SQL Database.
2/ Restore the Linked database.
3/ Run the scripts to build the views in the NAV database.
4/ Restore the FBK file.
Done.
The problem is when the views refer to tables that won't exist until the FBK is restored. You can't create the real views until those tables exist.
Are you refering to where you have created a view that is based on NAV tables, for example to make a JOIN?David Singleton0 -
David Singleton wrote:bbrown wrote:DenSter wrote:David Singleton wrote:That all sounds very complex. The way I do it is this:
1/ Create the NAV SQL Database.
2/ Restore the Linked database.
3/ Run the scripts to build the views in the NAV database.
4/ Restore the FBK file.
Done.
The problem is when the views refer to tables that won't exist until the FBK is restored. You can't create the real views until those tables exist.
Are you refering to where you have created a view that is based on NAV tables, for example to make a JOIN?
That would be one example. A more common scenario I see is when a NAV table is involed in a a JOIN with external data. In these cases I create the dummy view, restore, then create the actual view.
This is also way I rarely (if ever) use the NAV backup/restore with SQL.There are no bugs - only undocumented features.0 -
I've only used views into non-NAV tables, so I've never had to deal with this. I've always thought that when you execute a CREATE script, SQL Server will let you create the view even when the tables don't exist yet. If that's not the case, the constant version of the view would be the only way to make that work.
What a drag though, you'd have to keep track of two versions of each view.0 -
DenSter wrote:I've only used views into non-NAV tables, so I've never had to deal with this. I've always thought that when you execute a CREATE script, SQL Server will let you create the view even when the tables don't exist yet. If that's not the case, the constant version of the view would be the only way to make that work.
What a drag though, you'd have to keep track of two versions of each view.
I also though the same. I need to go back and check, because I was sure that what Daniel is saying worked.David Singleton0 -
Basically you would get a "Invalid object name 'DBName.dbo.Tablename'." error message when trying to create the view.
But again the dummy views with literal values are very easy to create, as suggested in the official documentation.
In this case though, the views refer to external databases - and i still dont know why it would error out on the restore - as i have restored it without problems.0 -
I am trying restore a Nav backup of a single company to a SQL Nav database which has views to a RMS database that has Joined Tables. The view that has no joined tables works fine; however, when I have a view with joined tables I get the error "Restoration of the backup was interrupted becuase the company ??? is already in the database. I guess the bottom line question is:
How would you create a test company with linked views to joined tables in a SQL database?0 -
SNielsen wrote:Basically you would get a "Invalid object name 'DBName.dbo.Tablename'." error message when trying to create the view.
But again the dummy views with literal values are very easy to create, as suggested in the official documentation.
In this case though, the views refer to external databases - and i still dont know why it would error out on the restore - as i have restored it without problems.
Thanks,
I think that clarifies what bbrown was saying.
Thanks to both of you.David Singleton0 -
Don't forget that if the linked table in NAV is company specific, that you will need a separate view for each company (Company1$SomeView, Company2$SomeView, etcetera). Inside NAV the linked table is called 'SomeView', but it will need one for each company.0
-
How exactly do I fix this issue? I have a view for each company but still get the error (due to the join of external tables) as stated in previous posts.0
-
I guess you'd have to create one of those dummy views for each company before restoring the backup.0
-
I have created a dummy view but due to a joined table I get the above error.0
-
Without access to your system I'm afraid I don't know how else to help you troubleshoot this issue.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