Skip to content

[BUG] T-SQL COALESCE output is not being set to the variable (SELECT or SET) #698

Description

@vineetnair

Describe the bug
Declare a variable to store COALESCE output. Run SELECT or SET to store the COALESCE output. The system returns error -
Incorrect syntax near 'COALESCE(NULL, 'Hello world!', 'Do not select this')'.
Unhandled expression type

To Reproduce
Query to reproduce the behavior:

DECLARE @Result VARCHAR(50);
SELECT @Result=COALESCE(NULL, 'Hello world!', 'Do not select this')
SELECT @Result

Expected behavior
The variable should get the value 'Hello world!' and should be shown in the results/output grid since we are selecting it at the end.

Environment (please complete the following information):

  • SQL 4 CDS edition: XrmToolBox
  • Results of SELECT @@VERSION: Microsoft Dataverse - 9.2.25073.188
    SQL 4 CDS - 10.0.0.0
    Jul 22 2025 18:04:45
    Copyright © 2020 - 2025 Mark Carrington

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions