pl-300 Practice Question 1927

Exam: pl-300
Domain: Prepare the data
Topic: Clean, transform, and load the data
Difficulty: medium
You are working on a data transformation project using Azure Data Factory and need to clean, transform, and load data from an Excel file into a SQL Server database. The Excel file contains a column with mixed data types (numeric and string values). You want to ensure that all numeric values are converted to integers before loading them into the database. Which M language script should you use to achieve this transformation?

Answer Options

A
type(text)
B
type(int)
C
type(number)
D
type(float)

Correct Answer

B: type(int)

Explanation

The correct answer is B because the `type` function in M can be used to convert the data type of a column. In this case, `type(int)` will convert the column to integer type, ensuring that only numeric values are kept and non-numeric values are removed or handled as per the requirement. Option A uses `type(text)` which does not perform any conversion. Option C uses `type(number)` which might not remove non-numeric values. Option D uses `type(float)` which also does not guarantee integer conversion.

Related Practice Questions