web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Insert data into NAV created tables thru SQL

(0) ShareShare
ReportReport
Posted on by

Is it possible to insert data from another database to NAV created tables thru backend, I mean thru SQL level?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    inserting/modifying data on sql level is in case of nav no good idea, because the according triggers on nav level are not run and the data integrity gets lost. so, better use web services to insert data. the nav source database provides a webservice (published codeunit, ...), which is consumed by nav target database.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Simple answer is Yes. You can insert data to NAV through direct SQL. However the concern is, is that the correct practice go forward.  

    When you insert data into NAV tables directly through SQL, NAV will not check any data validation or fire any trigger codes written in the table level. Therefore this is very risky and not recommended to proceed.

    What you can do is create some temp tables in NAV database and then push your data those tables. Once the data transfer is completed you can create a C/AL codes for the data integration to original NAV tables. This will fire the triggers in NAV and you will have no issues.

  • Suggested answer
    ksundeep87 Profile Picture
    800 on at

    Hi,

    May I know what exactly you are trying to do.

    Insert data from NAV Tables from other NAV instance? or Insert data from any linked Servers ?

    Are those the custom tables or base tables?

    If it is for any custom table from Linked Servers it is very simple, you can use Linked Objects property of the NAV tables. Check the below links. (never insert from back-end as it will bypass all the validations)

    http://dynamicsuser.net/blogs/waldo/archive/2008/11/08/how-to-display-an-sql-server-view-in-microsoft-dynamics-nav.aspx

    https://msdn.microsoft.com/en-us/library/dd338982.aspx 

    http://forum.mibuso.com/discussion/30778/linked-object-and-sql-view

    Hope this will help.

     

  • Suggested answer
    Roberto Stefanetti Profile Picture
    12,998 on at

    hi,

    IS NOT best practice (.Microsoft suggest to use Rapidstart Services, XML ports or exposed Web Services to import\export data)  ... but you can use a sql "SELECT INTO STATEMENT" to do this (can be useful for fast demo scenarios etc. and you can schedule..)

    look at this link:

    NAV to NAV SQL Fast Data Migration (with dynamic “INSERT INTO” STATEMENT)

    robertostefanettinavblog.wordpress.com/.../nav-to-nav-sql-fast-data-migration-with-dynamic-insert-into-statements

    or on my MSDN Page

    gallery.technet.microsoft.com/NAV-to-NAV-SQL-Fast-Data-4341b7e9

  • Alex A Profile Picture
    2,913 on at

    Please tell us specifically what you need to do. What is the end result you are trying to achieve?

  • Community Member Profile Picture
    on at

    Best practice are "don't do any operation in SQL"; but you can access SQL data source by codeunit (I hav a SQL Utility CodeUnit for that purpose) using net objs, then do read data from NAV CU and insert data in your instance with NAV C/AL functions.

    This approach allows non only nav triggering, but also the defautl values for every field in your NAV tabel record (NAV instance crashes with nulls).

    B/R

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans