Aggregate Functions wrongly put in square brackets
I think I 've found a bug...
If you Format this SQL
DECLARE @Translations TABLE
(
[FundTypeId] INT NOT NULL ,
[ColumnName] NVARCHAR(128) NULL ,
[ColumnValue] NVARCHAR(256) NULL ,
[InsertedAt] DATETIME NULL ,
[InsertedBy] NVARCHAR(256) NULL ,
[LastUpdatedAt] DATETIME NULL ,
[LastUpdatedBy] NVARCHAR(256) NULL ,
PRIMARY KEY ( [FundTypeId] )
);
SELECT *
FROM ( SELECT [pt].[FundTypeId] ,
[pt].[FundType] ,
[pt].[Comment] ,
[pt].[InsertedAt] ,
[pt].[InsertedBy] ,
[pt].[LastUpdatedAt] ,
[pt].[LastUpdatedBy]
FROM @Translations AS [tmp] PIVOT ( MAX([ColumnValue]) FOR [tmp].[ColumnName] IN ( [FundType], [Comment] ) ) AS [pt]
) AS [tmp];
... it will break the code as the MAX function of the PIVOT is put into square brackets...
Regards
Ralf
1
vote
Anonymous
shared this idea
We’ve just released a new build of Prompt ( 6.5.0.332) which should have a fix for this. You can get the latest version from our website http://www.red-gate.com/products/sql-development/sql-prompt/