Code with SQL

aavio
Member Posts: 143
hai friends...
i am new to sql,
i have a general doubt... is it possible to code with in sql tables(with sql), instead of using CAL in NAV :-k . :?: if its possible... which one is recommended more??? 8-[
thank you!
i am new to sql,
i have a general doubt... is it possible to code with in sql tables(with sql), instead of using CAL in NAV :-k . :?: if its possible... which one is recommended more??? 8-[
thank you!
aav!o
0
Comments
-
-
With several limitations, yes it's possible, but you will be wasting your time.0
-
aavio wrote:DenSter wrote:All NAV business logic is programmed in C/AL
yes, but is it possible to code same logic with sql...??
But do not forget that when the object is compiled in NAV, you can lost your changes, they can be in conflict with NAV or you can totally mess your database (e.g. when writing wrong data into CODE field in NAV etc.). I see the way of SQL only in some exceptional cases e.g. to create special view which can be connected into NAV as common table...0 -
aavio wrote:DenSter wrote:All NAV business logic is programmed in C/AL
yes, but is it possible to code same logic with sql...??0 -
Well, the question is what you mean by "code in sql tables"? The only "code" you could directly put in SQL Server tables is in SQL triggers, and generating customized triggers should happen only in very few/specific cases, due to the limitations/risks which were already mentioned here.
But: it might be smart to put some specific - custom - functions in SQL Stored Procedures, to benefit from the more powerful SQL features in querying, combining/joining and aggregating data! If there is not too much NAV business logic involved, this could remarkably improve your system!
These SP could be executed within NAV by using MS ADO as Automation Server; also the result set could be returned and processed inside NAV ...
So the short answer is: Yes, technically you could use SQL programming with NAV.
But if it's wise to it or not, depends on the actual purpose ...Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
thanks friends....
now i understood the issues while coding in database... and spl thanks to stryk, you had made my doubt more specific...ie with sql stored procedures will there be any problem with version change :?:stryk wrote:generating customized triggers should happen only in very few/specific cases, due to the limitations/risks which were already mentioned here.
Thanks a Lot 8)aav!o0 -
If you mean changing the version of NAV, then No, there will be no impact on the stored procedures.
When changing the NAV version it could happen that tables are re-created and this could mean that customized sql trigger code is deleted.
But though the custom stored procedures are part of the NAV database, the C/SIDE environment is not able to drop or change themn, actually NAV is not even aware these SP exist.
Hence, with using MSADO to execute SP you just create an "exit & entry point" in/to NAV.
Speaking of changing the SQL Server version, then of course there could be an issue with the SP; e.g. if you are using TSQL commands which were removed in a newer version (yes, this happens frequently).Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
Well, I would suggest NOT to use custom triggers on tables which are heavily used by NAV transactions as this might slow them down or - in worst case - joepardizes the data-consistency (depends on what the rigger is doing).
Further, I would not add triggers to tables which already have a standard NAV SIFT Trigger.
For example, I used - experimental - a trigger on the Object table for some kind of auditing (http://dynamicsuser.net/blogs/stryk/archive/2009/05/18/object-auditing.aspx) ...
But then again: it always depends ...Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
aavio wrote:can you please mention those few cases....
For general purposes, I do NOT agree that SQL programming should EVER be used AT ALL, especially when you don't know anything about NAV. Do not think, just because someone says "technically it is possible", that this means that you should start programming away in T-SQL. It is a road down to disaster.0 -
hi,
okkkey ,..i understand the issues...i just want to clear my doubts....so creating triggers and stored procedures, are not recommended unless issue hav no other way...right??...ok...
Then just viewing data by qureying it will be ok naa... but in sql tables, i could not find the flowfields... why its soo...? :-k is it means that in sql database level tables doesnt maintain the relations between them... and only with finsql.exe application it will be maintained??? :shock:aav!o0 -
Then just viewing data by qureying it will be ok naa... but in sql tables, i could not find the flowfields... why its soo...?
Flow fields are runtime fields and in database table, they are not part of database tables. System maintains them and can be used only in Navision UI (cal etc) only as far as I know.
May be some one else can put some more notes on it if it is possible to use it directly in database.
I was thinking to create some dataviews to populate some aggregated data in separate sql tables but still working on the best option.
It was a useful post for me. Cheers.KS0 -
"kamranshehzad wrote:Flow fields are runtime fields and in database table, they are not part of database tables. System maintains them and can be used only in Navision UI (cal etc) only as far as I know.
May be some one else can put some more notes on it if it is possible to use it directly in database.
I was thinking to create some dataviews to populate some aggregated data in separate sql tables but still working on the best option.
It was a useful post for me. Cheers.
Here I publish a little tool which should create this sub-query TSQL: http://www.mibuso.com/dlinfo.asp?FileID=1101
(please refer to the related forum discussion about details)
Regards,
JörgJörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
What are you trying to do in sql?
Format doesn't work on 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