I have some SQL similar to the below example and it fails to format because it adds the table alias to the column alias when the column alias is the same as an existing column inside the IF, I need to change the column alias to something else for it to format, e.g. [is_ms_shipped2]. SQL Prompt 11.3.6.21421 on Azure SQL database.
SELECT
*
, CAST (IIF([o].[is_ms_shipped] = 0 AND DATEDIFF (DAY, CURRENT_DATE, [o].[create_date]) BETWEEN 0 AND 7, 1, [o].[is_ms_shipped]) AS [BIT]) AS [is_ms_shipped]
FROM [sys].[objects] AS [o];
I have some SQL similar to the below example and it fails to format because it adds the table alias to the column alias when the column alias is the same as an existing column inside the IF, I need to change the column alias to something else for it to format, e.g. [is_ms_shipped2]. SQL Prompt 11.3.6.21421 on Azure SQL database.