Copy Company

AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
edited 2013-10-21 in Download section
Copy Company
-Copy data from 1 company to another (in the same or another DB) directly in SQL.
-You can select the tables you want to copy (also "DataPerCompany=No"-tables)

- based on: http://mibuso.com/blogs/ara3n/2009/12/0 ... comment-98

-how to use:
-create a new company (in the same DB or a new DB)
-define from and to - database+Company
-give a name for the script
-decide to include or not the "DataPerCompany=No"-tables
-decide if you want 1 big transaction or a transaction per table
-filter the tables you want to copy
-generate the script
-run the script in SSMS

-Warning:
-do NOT use this method as a backup-tool in production. Referential Integrity is NOT guaranteed.

http://www.mibuso.com/dlinfo.asp?FileID=1171

Discuss this download here.

Comments

  • krikikriki Member, Moderator Posts: 9,115
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • sveinur77sveinur77 Member Posts: 2
    Hi

    Great tool, we have been looking for something like this..
    I have one problemn though, still.. Would it be possible to copy between different SQL servers also??
    We are running multi server environment, so it is not enough being able to copy company within database on the same SQL server..
  • krikikriki Member, Moderator Posts: 9,115
    I didn't test this, but you can try it. Probably you need to create a linked server in SQL. Maybe it works in that way.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • sveinur77sveinur77 Member Posts: 2
    Hi again

    I have tested it with Linked Server and it works fine.

    I had to make a small correction to your form in order to get the SQL query to use the fourpart SQL command [server].[database].[schema]., but then it worked as a charm :D

    Br
    Sveinur
  • easy-navieasy-navi Member Posts: 31
    I've tried to use it but there is a problem. When I click 'run' the finsql.exe crashes :/
    What is the reason?
    p.s.
    I have: Nav 4.03, Sql2005, Windows7, (on WinXp it crashes also).
    http://www.reinwestuj.pl Inwestuj w nieruchomości. Condohotele, aparthotele.
  • krikikriki Member, Moderator Posts: 9,115
    I programmed it with NAV2009 or NAV2009SP1. So if you use it with an older version, it crashes. Try to open it in a NAV2009SP1 or later.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • mdPartnerNLmdPartnerNL Member Posts: 802
    This looks like a replacement for 2013 backup. Thx. :shock:

    Are there really no cons? does it copy all data?
  • krikikriki Member, Moderator Posts: 9,115
    To be honest, I never tried it with NAV2013 R2.

    And there is a con: while the script is running, no one should work on the 2 companies involved.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • mdPartnerNLmdPartnerNL Member Posts: 802
    That's no con, that's normal. Thanks for replying.

    Will it work with blob, pictures, bigtext ?
  • ara3nara3n Member Posts: 9,256
    yes it works with those data types as well.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mdPartnerNLmdPartnerNL Member Posts: 802
    wow, then it is definitely useful.

    About the remark of "Referential Integrity". If the generated script writes all the data into the new tables the this is ok too..
Sign In or Register to comment.