Wondering if anyone has suggestions on implementing a case or IF statement with U-SQL. For example, how do i convert this:
SELECT
FirstName, LastName,
Salary, DOB,
CASE Gender
WHEN 'M' THEN 'Male'
WHEN 'F' THEN 'Female'
END
FROM Employees;
You can use an inline C# expression for simple things like so (did not test it yet though)
SELECT
FirstName, LastName,
Salary, DOB,
Gender == "Male" ? "M" : "F"
FROM Employees
If it is more complex consider writing a user defined operator in C#.
Have a look at the MSDN tutorial here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With