I recently got a full SQL Server 2012 database files(.mdf,.ldf…) on one of the implementation projects I’m working on and restored it into my machine using SSMS and then started working on it right away in NAV C/SIDE. Doing so got me thinking and asked myself, where does actually C/AL code reside? is it in SQL Server database or NAV software?
Okay. If it is sitting in NAV software, what will happen if we detach the database, make a copy and attach it on a different server/instance? Here is a scenario I did.
I had detached a SQL database for NAV2013, which has got tons of customized and add-on objects from a development server and took copy of the database to be used on another test server. The test server is on a completely new physical server for which we had just installed NAV2013. Then I moved the copied database into the test server and attached it through SQL Server Management Studio. After that, we opened C/SIDE and found all the objects from the copied database including the customized ones.
Now, how did the customized and add-on objects get into the new test server without using NAV2013 software?
The C/AL code is stored in the Object table records for each NAV object. While that table is accessible from SQL, the code is really only accesible from the NAV client.
That means the objects are in the SQL server, not in NAV. Digging further in SSMS, I found out that there are two tables that contain the objects and their C/AL code in the form of image. Check them out. I hope you understand my dilemma to accept all NAV objects are sitting in NAV software. Thanks.
When Mohana said that the code is in NAV software, I’m pretty sure that he was referring to the NAV database and not the client executables. Hope that makes it a bit more clear?
You’re right too. The NAV database is a SQL database, and the NAV Objects, along with the C/AL Code that they contain, are records within that database. The actual C/AL Code is in that BLOB field you found. Nice!