NAVDBCopy.sql

Administrator
Member, Moderator, Administrator Posts: 2,506
NAVDBCopy.sql
NAV DB Copy - Copy companies between databases
This script is a solution for copying companies between databases on the same server or between linked servers. It can also be used to downgrade a SQL database from 2012 to 2008.
Since the Backup and Restore feature has been removed in NAV 2013 R2, I was searching for an alternative way to copy companies between databases. Among the goals were to support linked servers and to be a SQL only solution which could potentially be automated later on.
Usage:
1) Create an exact copy of the source database, all tables must be identical. Importing the objects as FOB is fine. This will be the destination database
2) Connect to the new database using the Windows Client and create a new Company. It must have exactly the same name as the Company in the source database
3) Open this script in a new Query Window in SQL Server Management Studio
4) Set the name of the destination database below ("USE DATABASENAME...")
5) Scroll down and set the name of the source database. You may also specify a linked server if the source database is on a remote SQL Server
6) Set the name of the company to copy
7) Optional: Specify all the DataPerCompany=No tables that you want to copy along by adding one "EXECUTE NAVCopyTable..." per table. Examples can be found below
8 ) Run the script to start the copy
http://www.mibuso.com/dlinfo.asp?FileID=1583
Discuss this download here.
NAV DB Copy - Copy companies between databases
This script is a solution for copying companies between databases on the same server or between linked servers. It can also be used to downgrade a SQL database from 2012 to 2008.
Since the Backup and Restore feature has been removed in NAV 2013 R2, I was searching for an alternative way to copy companies between databases. Among the goals were to support linked servers and to be a SQL only solution which could potentially be automated later on.
Usage:
1) Create an exact copy of the source database, all tables must be identical. Importing the objects as FOB is fine. This will be the destination database
2) Connect to the new database using the Windows Client and create a new Company. It must have exactly the same name as the Company in the source database
3) Open this script in a new Query Window in SQL Server Management Studio
4) Set the name of the destination database below ("USE DATABASENAME...")
5) Scroll down and set the name of the source database. You may also specify a linked server if the source database is on a remote SQL Server
6) Set the name of the company to copy
7) Optional: Specify all the DataPerCompany=No tables that you want to copy along by adding one "EXECUTE NAVCopyTable..." per table. Examples can be found below
8 ) Run the script to start the copy
http://www.mibuso.com/dlinfo.asp?FileID=1583
Discuss this download here.
0
Comments
-
Thx, for this solution.
Its called DBCopy but after further reading its a company copy, which is good
Do you have any ideas on how to save the original source first in this script? take to customer and then execute the rest of this script?
Would this be possible?0 -
mdPartnerNL wrote:Do you have any ideas on how to save the original source first in this script? take to customer and then execute the rest of this script?0
-
no, I mean save company to disk, then take to customer..0
-
Not supported by this script. But you could simply transport a SQL backup to the customer for this purpose and then run the script on that copy.0
-
The db is 40Gb and I only need to upload 1 company :? I guess I need to these steps twice: copy company to a new db, make small backup, restore backup, then copy.
a .fbk used to be so easy.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