SQL ADO Query

ajayjain
Member Posts: 119
Hi,
I am writing a small functionality into Navision which will transfer data from 1 db to another db using ado
user will be able to configure himself, which tables and filters etc. like sales order for this department should be copied into another db.
it will generate sql script and execute.
It works fine but....getting some issues like
if in table 'Payment Terms' I got 5 records and other db has 3 then it should transfer only 2 records.
this should also work on SO, PO etc. which has different primary keys
Any suggestion?
I don't want to loop through records and update 1 by 1
Also timestamp is causing problem so I have to add fields names in sql script
Any suggestion please
I am writing a small functionality into Navision which will transfer data from 1 db to another db using ado
user will be able to configure himself, which tables and filters etc. like sales order for this department should be copied into another db.
it will generate sql script and execute.
It works fine but....getting some issues like
if in table 'Payment Terms' I got 5 records and other db has 3 then it should transfer only 2 records.
this should also work on SO, PO etc. which has different primary keys
Any suggestion?
I don't want to loop through records and update 1 by 1
Also timestamp is causing problem so I have to add fields names in sql script
Any suggestion please
Ajay Jain
UK
UK
0
Comments
-
Hi,
I don't think it is a good idea to do it directly on the SQL level. I would use the webservices and validate everything in the second database, if possible. If you can't use the webservices I would still use a simple file based export and import and try to automate that using an NAS. (Or use an add-on that does exactly that for you)
If you want to use SQL and only update the records that does not exists you can use a where clause on the INSERT statement (if it is an UPDATE it works too). You can find a lot of examples if you google for conditional insert or 'NOT EXISTS' and T-SQL.0
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