MS SQL Server:(NOWAIT) Vs (NOLOCK) Hints

Purpose:

The purpose of this post is to explain the basic difference between two hints i.e.(NOWAIT) Vs (NOLOCK) in microsoft SQL server.

SELECT * FROM INVENTTABLEDWH WITH (NOLOCK)

SELECT * FROM INVENTTABLEDWH WITH (NOWAIT)

(NOLOCK) hint will able to read the data even if transactions are locked.Transactions can be locked due to any update or delete query.Select query with (NOLOCK) hint can return invalid or dirty data as it will fetch records even if transactions are locked.

(NOWAIT) hint will able to read the data even if transactions are locked but return you an error.

 

D365/AX7:SysDa In X++..Query Classes killer?

Introduction

In D365 FO PU 22, Microsoft introduced a new set of API for performing DML commands- select, update, delete & insert .This is called SysDa (System Data Access).

what makes SysDa different from simple X++ select statements or query object models?…

  1. SysDa is extensible whereas simple X++ select, update, delete, insert statements are not.
  2. SysDa supports update_recordSet, delete_recordSet, Insert_recordset where as Query classes or query object model does not support recordSet commands.
  3. SysDa performance is as good as simple X++ select, update, delete, insert statements.

Indeed, SysDa is a great new feature but does it mean SysDa is a Query Classes killer?….

No…Query classes or query object model still has upper hand on some parts.You can create a query directly in AOT and can use it view, reports etc. without writing a single line code.You can reuse a query again and again.The best thing about query you can pass comma separated string values like (100,101,102,103) as filter range but the same you cannot achieve it SysDa.

Sample 

update.png

loop.png

D365 FO/Logic Apps: REST Service For Accepting JSON & Inserting Records Into A Table

LogicApps

Requirement

Third party Vendor wants to push records in D365 Finance and operation by providing input in a JSON format.

JSON Format:

1

Purpose

The purpose of the document is to provide all the necessary steps of developing a REST web service in Logic Apps which will accept JSON message as input. Parse of JSON string will happen in Logic Apps & records will inserted into a table of D365 Finance and operation environment using data entities.

Perquisites

  1. Logic Apps subscription is required
  2. D365 Finance and operation development environment.
  3. Documents related to JSON schema and format should be shared with developer
  4. D365 Data entities should be accessible from outside. In my case I have 2 tables and 2 data entities of both the tables. Tables Name are OrderHeader & OrderLines.23

Steps

  1. Generate the JSON schema by using URL https://jsonschema.net/ using JSON sample4
  2. Create a new Logic Apps from blank template.
  3. Add a trigger of type “REQUEST” – When a HTTP request is received and paste the JSON schema created in step 1 into the section Request Body JSON Schema5
  4. Add a new step and use the new action of type Data Operation – Parse JSON.6
  5. (In case you require) Add a new step for initializing a variable. I am using here Initialize variable action .I am using it for line number counter later.fff
  6. Add a new step by using control – For Each7
  7. Add a new step by using action “Create record”-Dynamics 365 for fin & ops. Provide D365 environment URL , data entity name & credentials. In this example I am using entity OrderHeader.This step should be inside “For Each” loop and we will insert Orderheader data.89
  8. After inserting record into OrderHeader entity , we will fill details by using OrderLine Entity.Flow is mentioned below1011
  9. Save your flow
  10. Copy the HTTP POST URL12
  11. For testing visit website https://apitester.com/13
  12. Records are inserted14

cheers

piyush adhikari 🙂