How to rename / drop company from SQL script

herrJones
Member Posts: 8
Hello all,
We try to automate the backup/restore procedure for our LIVE-to-TEST procedure.
We are able to backup/restore everything via SSIS.
Now the question remains whether we can automatically:
Thanks,
Jan
We try to automate the backup/restore procedure for our LIVE-to-TEST procedure.
We are able to backup/restore everything via SSIS.
Now the question remains whether we can automatically:
- drop a company within the restored database
- rename a company within the restored database
Thanks,
Jan
0
Comments
-
I think it will be very difficult to do from T-SQL.
I will suggest to experimenting by doing it in C/AL. Simply rename the Company by code - I guess it will work.
If it doesn't work to delete a Company record, you simply need to delete all TableData records for the company in the object table. I guess it will work.
To automate it, you could either user ExpandIT Launch Utillity, or NAV2009 WebServer, or maybe a solution with the NAS. It depends on the enviroment you got.Regards
Peter0 -
What's wrong with doing it the standard way?There are no bugs - only undocumented features.0
-
@pdj: thanx, but that's what I feared for :-k
I could try it out on one of our development databases. I am not a specialist in C/AL. Just an 'advanced' user...
Could you please give an example or a good reference where I can start reading?
The setup is NAV2009 (no rtc) with a NAS. Not sure however how this works exactly.
@bbrown: I just want to avoid doing the same thing 4 times, when we do a 'live to develop'-restore, deleting companies from the restored 'live' database and renaming the remaining company to a new one. If I could just launch a job...
Kind regards,
Jan0 -
That seems like you do a lot of testing if you need this? Maybe you want to rethink how many changes you are making to your system and how often.David Singleton0
-
herrJones wrote:I am not a specialist in C/AL. Just an 'advanced' user...
Any C/AL developer will be able to do it the actual coding in a few minutes, the problem is more to get it automated...
The code could be something like this: (NOT TESTED AT ALL - NOT EVEN TESTED FOR COMPILATION ERRORS ! USE AT OWN RISK !!!!)
Global: Company, Record, Company
// To delete a company...
Company.GET('Some Company Name');
Company.DELETE(TRUE);
// To rename a company...
Company.GET('Old Company Name');
Company.RENAME('New Company Name');Regards
Peter0
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