azureazure-data-factoryazure-data-lakeu-sql

Convert data type and concat column in u-sql


How to convert datatype and concat columns in U-SQL?

@output =
    SELECT DISTINCT (kco.ToString + "-" + hta_ref.ToString + "-" + his_ref.ToString) AS hs_isstaskID,
                    (kco.ToString + "-" + his_ref.ToString) AS HS_IssueID,
                    (kco.ToString + "-" + hta_ref.ToString) AS hs_task_ID,
                    *
    FROM @input;

Solution

  • ToString is a method so normally takes brackets, eg

    @output =
        SELECT DISTINCT (kco.ToString() + "-" + hta_ref.ToString() + "-" + his_ref.ToString()) AS hs_isstaskID,
                        (kco.ToString() + "-" + his_ref.ToString()) AS HS_IssueID,
                        (kco.ToString() + "-" + hta_ref.ToString()) AS hs_task_ID,
                        *
        FROM @input;
    

    If the data conversions cause problems then you may need to implement TryParse as per here.