mibuso.com

Microsoft Business Solutions online community
It is currently Sun Nov 23, 2014 3:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: How to rename / drop company from SQL script
PostPosted: Thu Dec 08, 2011 1:52 pm 
Offline

Joined: Thu Dec 08, 2011 1:36 pm
Posts: 5
Country: Belgium (be)
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:

  • drop a company within the restored database
  • rename a company within the restored database
Can this be done via a SQL-script (or another, automated way)?

Thanks,

Jan


Top
 Profile  
 
 Post subject: Re: How to rename / drop company from SQL script
PostPosted: Fri Dec 09, 2011 12:28 am 
Offline

Joined: Wed Nov 24, 1999 7:01 am
Posts: 581
Location: Aalborg,Denmark
Country: Denmark (dk)
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
Peter


Top
 Profile  
 
 Post subject: Re: How to rename / drop company from SQL script
PostPosted: Fri Dec 09, 2011 1:01 am 
Offline

Joined: Tue Jun 07, 2005 4:24 pm
Posts: 2867
Location: MA
Country: United States (us)
What's wrong with doing it the standard way?

_________________
There are no bugs - only undocumented features.


Top
 Profile E-mail  
 
 Post subject: Re: How to rename / drop company from SQL script
PostPosted: Fri Dec 09, 2011 8:55 am 
Offline

Joined: Thu Dec 08, 2011 1:36 pm
Posts: 5
Country: Belgium (be)
@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,

Jan


Top
 Profile  
 
 Post subject: Re: How to rename / drop company from SQL script
PostPosted: Fri Dec 09, 2011 1:29 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Tue Aug 14, 2001 6:01 am
Posts: 5349
Location: Prague
Country: Czech Republic (cz)
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 Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: How to rename / drop company from SQL script
PostPosted: Fri Dec 09, 2011 3:37 pm 
Offline

Joined: Wed Nov 24, 1999 7:01 am
Posts: 581
Location: Aalborg,Denmark
Country: Denmark (dk)
herrJones wrote:
I am not a specialist in C/AL. Just an 'advanced' user...

Then I'll have to suggest, that you contact your NAV partner :wink:

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
Peter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: