Microsoft Dynamics 365: Finance and Operations Apps Developer Exam MB-500

Embedded-SQL Statement for Sorting FMVehicle Table by VehicleId

Question

You are a Dynamics 365 Finance developer.

You have a table named FMVehicle that contains a field named VehicleId.

The table has an index named VehicleIdIdx on the VehicleId field.

You declare a table buffer named vehicle to refer to the table.

You need to select all records from the FMVehicle table in ascending order based on VehicleId field in the vehicle variable.

Which embedded-SQL statement should you use?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

B.

https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-data-query

The correct embedded-SQL statement to select all records from the FMVehicle table in ascending order based on the VehicleId field in the vehicle variable is option C:

sql
select VehicleId from vehicle order by VehicleId asc;

Here's an explanation of each option:

Option A:

perl
select vehicle index VehicleId;

This statement is incorrect because it only specifies the index to use for the query, but it does not actually select any fields or order the results.

Option B:

vbnet
select vehicle order by VehicleId;

This statement is incorrect because it orders the results by the VehicleId field, but it does not specify whether it should be in ascending or descending order.

Option C:

sql
select VehicleId from vehicle order by VehicleId asc;

This statement is correct because it selects the VehicleId field from the vehicle buffer and orders the results in ascending order based on the VehicleId field. This will return all records from the FMVehicle table sorted in ascending order based on the VehicleId field.

Option D:

sql
select vehicle order by VehicleId desc;

This statement is incorrect because it orders the results by the VehicleId field in descending order, but the question specifically asks for ascending order.